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 (int i=0; i < lGSubrsUsed.size(); i++) {
    int Subr=(int)lGSubrsUsed.get(i);
    if (Subr < gsubrOffsets.length - 1 && Subr >= 0) {
      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++) {
            int LSubr=(int)lSubrsUsedNonCID.get(j);
            if (LSubr < fonts[Font].SubrsOffsets.length - 1 && LSubr >= 0) {
              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();
        }
      }
    }
  }
}

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 ( int i = 0 ; i < lGSubrsUsed . size ( ) ; i ++ ) { int Subr = ( int ) lGSubrsUsed . get ( i ) ; if ( Subr < gsubrOffsets . length - 1 && Subr >= 0 ) { 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 ++ ) { int LSubr = ( int ) lSubrsUsedNonCID . get ( j ) ; if ( LSubr < fonts [ Font ] . SubrsOffsets . length - 1 && LSubr >= 0 ) { 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 list to find recursive calls to gsubrs and adds to map & list
