Exemple #1
0
            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);
            }
Exemple #2
0
            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);
            }
Exemple #3
0
            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);
            }