private void GetCompositeGlyphStats(Table_glyf.CompositeGlyph cg, ref short nContours, ref ushort nPoints, ref ushort nInstructions, ref ushort nComponentElements, ref ushort nComponentDepth, OTFont fontOwner, Table_glyf glyfTable) { ushort nPointsTemp = 0; short nContoursTemp = 0; ushort nInstructionsTemp = 0; short TotalContours = 0; ushort TotalPoints = 0; ushort maxInstructions = 0; nComponentDepth++; int nCompositeGlyphs = 0; while (cg != null) { nCompositeGlyphs++; nInstructions = Math.Max(nInstructions, cg.GetNumInstructions()); Table_glyf.header glyfHeader = glyfTable.GetGlyphHeader(cg.glyphIndex, fontOwner); if (glyfHeader != null) { if (glyfHeader.numberOfContours >= 0) { nContoursTemp = glyfHeader.numberOfContours; Table_glyf.SimpleGlyph sg = glyfHeader.GetSimpleGlyph(); nPointsTemp = (ushort)(sg.GetEndPtOfContour((uint)glyfHeader.numberOfContours-1)+1); nInstructionsTemp = sg.instructionLength; } else { Table_glyf.CompositeGlyph EmbeddedCG = glyfHeader.GetCompositeGlyph(); GetCompositeGlyphStats(EmbeddedCG, ref nContoursTemp, ref nPointsTemp, ref nInstructionsTemp, ref nComponentElements, ref nComponentDepth, fontOwner, glyfTable); } TotalContours += nContoursTemp; TotalPoints += nPointsTemp; maxInstructions = Math.Max(maxInstructions, nInstructionsTemp); } cg = cg.GetNextCompositeGlyph(); } nComponentElements = (ushort)Math.Max(nComponentElements, nCompositeGlyphs); nContours = TotalContours; nPoints = TotalPoints; nInstructions = maxInstructions; }