protected void ReadASubr(int begin,int end,int GBias,int LBias,Map<Integer,int[]> hSubr,List<Integer> lSubr,int[] LSubrsOffsets){
  EmptyStack();
  NumOfHints=0;
  seek(begin);
  while (getPosition() < end) {
    ReadCommand();
    int pos=getPosition();
    Object TopElement=null;
    if (arg_count > 0)     TopElement=args[arg_count - 1];
    int NumOfArgs=arg_count;
    HandelStack();
    if (null != key) switch (key) {
case "callsubr":
      if (NumOfArgs > 0) {
        int Subr=(int)((Integer)TopElement) + LBias;
        if (!hSubr.containsKey(Subr)) {
          hSubr.put(Subr,null);
          lSubr.add(Subr);
        }
        CalcHints(LSubrsOffsets[Subr],LSubrsOffsets[Subr + 1],LBias,GBias,LSubrsOffsets);
        seek(pos);
      }
    break;
case "callgsubr":
  if (NumOfArgs > 0) {
    int Subr=(int)((Integer)TopElement) + GBias;
    if (!hGSubrsUsed.containsKey(Subr)) {
      hGSubrsUsed.put(Subr,null);
      lGSubrsUsed.add(Subr);
    }
    CalcHints(gsubrOffsets[Subr],gsubrOffsets[Subr + 1],LBias,GBias,LSubrsOffsets);
    seek(pos);
  }
break;
case "hstem":
case "vstem":
case "hstemhm":
case "vstemhm":
NumOfHints+=NumOfArgs / 2;
break;
case "hintmask":
case "cntrmask":
NumOfHints+=NumOfArgs / 2;
int SizeOfMask=NumOfHints / 8;
if (NumOfHints % 8 != 0 || SizeOfMask == 0) SizeOfMask++;
for (int i=0; i < SizeOfMask; i++) {
getCard8();
}
break;
}
}
}

protected void ReadASubr ( int begin , int end , int GBias , int LBias , Map < Integer , int [ ] > hSubr , List < Integer > lSubr , int [ ] LSubrsOffsets ) { EmptyStack ( ) ; NumOfHints = 0 ; seek ( begin ) ; while ( getPosition ( ) < end ) { ReadCommand ( ) ; int pos = getPosition ( ) ; Object TopElement = null ; if ( arg_count > 0 ) TopElement = args [ arg_count - 1 ] ; int NumOfArgs = arg_count ; HandelStack ( ) ; if ( null != key ) switch ( key ) { case "callsubr" : if ( NumOfArgs > 0 ) { int Subr = ( int ) ( ( Integer ) TopElement ) + LBias ; if ( ! hSubr . containsKey ( Subr ) ) { hSubr . put ( Subr , null ) ; lSubr . add ( Subr ) ; } CalcHints ( LSubrsOffsets [ Subr ] , LSubrsOffsets [ Subr + 1 ] , LBias , GBias , LSubrsOffsets ) ; seek ( pos ) ; } break ; case "callgsubr" : if ( NumOfArgs > 0 ) { int Subr = ( int ) ( ( Integer ) TopElement ) + GBias ; if ( ! hGSubrsUsed . containsKey ( Subr ) ) { hGSubrsUsed . put ( Subr , null ) ; lGSubrsUsed . add ( Subr ) ; } CalcHints ( gsubrOffsets [ Subr ] , gsubrOffsets [ Subr + 1 ] , LBias , GBias , LSubrsOffsets ) ; seek ( pos ) ; } break ; case "hstem" : case "vstem" : case "hstemhm" : case "vstemhm" : NumOfHints += NumOfArgs / 2 ; break ; case "hintmask" : case "cntrmask" : NumOfHints += NumOfArgs / 2 ; int SizeOfMask = NumOfHints / 8 ; if ( NumOfHints % 8 != 0 || SizeOfMask == 0 ) SizeOfMask ++ ; for ( int i = 0 ; i < SizeOfMask ; i ++ ) { getCard8 ( ) ; } break ; } } }
the function reads a subrs ( glyph info ) between begin and end . adds calls to a lsubr to the hsubr and lsubrs . adds calls to a gsubr to the hgsubr and lgsubrs .
