Пример #1
0
            public List <SequentialMapGroup> groups;    // Array of SequentialMapGroup records.

            public void Read(TTFReader r, bool readformat = false)
            {
                if (readformat == true)
                {
                    r.ReadInt(out this.format);
                }
                else
                {
                    this.format = 8;
                }

                r.ReadInt(out this.reserved);
                r.ReadInt(out this.length);
                r.ReadInt(out this.language);

                this.is32 = new List <byte>();
                for (int i = 0; i < 8192; ++i)
                {
                    this.is32.Add(r.ReadUInt8());
                }

                r.ReadInt(out this.numGroups);

                this.groups = new List <SequentialMapGroup>();
                for (int i = 0; i < this.numGroups; ++i)
                {
                    SequentialMapGroup smg = new SequentialMapGroup();
                    smg.Read(r);
                    this.groups.Add(smg);
                }
            }
Пример #2
0
        public override bool TryGetGlyphId(int codePoint, out ushort glyphId)
        {
            uint charAsInt = (uint)codePoint;

            for (int i = 0; i < this.SequentialMapGroups.Length; i++)
            {
                ref SequentialMapGroup seg = ref this.SequentialMapGroups[i];

                if (charAsInt >= seg.StartCodePoint && charAsInt <= seg.EndCodePoint)
                {
                    glyphId = (ushort)((charAsInt - seg.StartCodePoint) + seg.StartGlyphId);
                    return(true);
                }
            }