public uint CalcLength() { uint length = 0; if (AnyComponentsHaveInstructions()) { length += (uint)2 + GetNumInstructions(); } CompositeGlyph nextCG = this; while (nextCG != null) { length += nextCG.GetCompositeGlyphLength(); nextCG = nextCG.GetNextCompositeGlyph(); } return(length); }
public ushort GetNumInstructions() { ushort nInstructions = 0; if (AnyComponentsHaveInstructions()) { // instructions follow the last component CompositeGlyph lastCG = this; CompositeGlyph nextCG = GetNextCompositeGlyph(); while (nextCG != null) { lastCG = nextCG; nextCG = lastCG.GetNextCompositeGlyph(); } uint nOffset = lastCG.m_offsetCompositeGlyph + lastCG.GetCompositeGlyphLength(); nInstructions = m_bufTable.GetUshort(nOffset); } return(nInstructions); }
public byte GetInstruction(uint i) { byte byteInstruction = 0; ushort nInstructions = 0; if (AnyComponentsHaveInstructions()) { // instructions follow the last component CompositeGlyph lastCG = this; CompositeGlyph nextCG = GetNextCompositeGlyph(); while (nextCG != null) { lastCG = nextCG; nextCG = lastCG.GetNextCompositeGlyph(); } uint nOffset = lastCG.m_offsetCompositeGlyph + lastCG.GetCompositeGlyphLength(); nInstructions = m_bufTable.GetUshort(nOffset); if (i < nInstructions) { byteInstruction = m_bufTable.GetByte(nOffset + 2 + i); } else { throw new ArgumentException(); } } else { throw new ApplicationException("WE_HAVE_INSTRUCTIONS flag is clear"); } return(byteInstruction); }