protected void BuildGSubrsUsed ( int Font ) { int LBias = 0 ; int SizeOfNonCIDSubrsUsed = 0 ; if ( fonts [ Font ] . privateSubrs >= 0 ) { LBias = CalcBias ( fonts [ Font ] . privateSubrs , Font ) ; SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID . size ( ) ; } // For each global subr used for ( int i = 0 ; i < lGSubrsUsed . size ( ) ; i ++ ) { //Pop the value + check valid int Subr = ( ( Integer ) lGSubrsUsed . get ( i ) ) . intValue ( ) ; if ( Subr < gsubrOffsets . length - 1 && Subr >= 0 ) { // Read the subr and process int Start = gsubrOffsets [ Subr ] ; int End = gsubrOffsets [ Subr + 1 ] ; if ( fonts [ Font ] . isCID ) ReadASubr ( Start , End , GBias , 0 , hGSubrsUsed , lGSubrsUsed , null ) ; else { ReadASubr ( Start , End , GBias , LBias , hSubrsUsedNonCID , lSubrsUsedNonCID , fonts [ Font ] . SubrsOffsets ) ; if ( SizeOfNonCIDSubrsUsed < lSubrsUsedNonCID . size ( ) ) { for ( int j = SizeOfNonCIDSubrsUsed ; j < lSubrsUsedNonCID . size ( ) ; j ++ ) { //Pop the value + check valid int LSubr = ( ( Integer ) lSubrsUsedNonCID . get ( j ) ) . intValue ( ) ; if ( LSubr < fonts [ Font ] . SubrsOffsets . length - 1 && LSubr >= 0 ) { // Read the subr and process int LStart = fonts [ Font ] . SubrsOffsets [ LSubr ] ; int LEnd = fonts [ Font ] . SubrsOffsets [ LSubr + 1 ] ; ReadASubr ( LStart , LEnd , GBias , LBias , hSubrsUsedNonCID , lSubrsUsedNonCID , fonts [ Font ] . SubrsOffsets ) ; } } SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID . size ( ) ; } } } } }
Function scans the Glsubr used ArrayList to find recursive calls to Gsubrs and adds to Hashmap & ArrayList