protected void BuildSubrUsed(int Font,int FD,int SubrOffset,int[] SubrsOffsets,Dictionary<int,int[]> hSubr,List<int> lSubr)
{
// Calc the Bias for the subr index
int LBias = CalcBias(SubrOffset,Font);
// For each glyph used find its GID, start & end pos
for (int i=0;i<glyphsInList.Count;i++)
{
int glyph = glyphsInList[i];
int Start = fonts[Font].charstringsOffsets[glyph];
int End = fonts[Font].charstringsOffsets[glyph+1];
// IF CID:
if (FD >= 0)
{
EmptyStack();
NumOfHints=0;
// Using FDSELECT find the FD Array the glyph belongs to.
int GlyphFD = fonts[Font].FDSelect[glyph];
// If the Glyph is part of the FD being processed
if (GlyphFD == FD)
// Find the Subrs called by the glyph and insert to hash:
ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
}
else
// If the font is not CID
//Find the Subrs called by the glyph and insert to hash:
ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
}
// For all Lsubrs used, check recusrivly for Lsubr & Gsubr used
for (int i=0;i<lSubr.Count;i++)
{
// Pop the subr value from the hash
int Subr = lSubr[i];
// Ensure the Lsubr call is valid
if (Subr < SubrsOffsets.Length-1 && Subr>=0)
{
// Read and process the subr
int Start = SubrsOffsets[Subr];
int End = SubrsOffsets[Subr+1];
ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
}
}
}