Example #1
0
            public List <uint>   idRangeOffsets; // Offsets into glyphIdArray or 0

            //public List<ushort> glyphIdArray;   // Glyph index array (arbitrary length)

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

                r.ReadInt(out this.length);
                r.ReadInt(out this.language);
                r.ReadInt(out this.segCountX2);
                r.ReadInt(out this.searchRange);
                r.ReadInt(out this.entrySelector);
                r.ReadInt(out this.rangeShift);

                uint segCt = (uint)this.segCountX2 / 2;

                this.endCode = new List <ushort>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.endCode.Add(r.ReadUInt16());
                }

                r.ReadInt(out this.reservePad);

                this.startCode = new List <ushort>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.startCode.Add(r.ReadUInt16());
                }

                this.idDelta = new List <short>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.idDelta.Add(r.ReadInt16());
                }

                this.idRangeOffsets = new List <uint>();
                for (int i = 0; i < segCt; ++i)
                {
                    uint ro = r.ReadUInt16();

                    if (ro != 0)
                    {
                        // glyphId = *(idRangeOffset[i] / 2
                        //              + (c - startCode[i])
                        //              + &idRangeOffset[i])
                        uint addr = (uint)r.GetPosition() - 2;
                        ro = addr + ro;
                    }
                    this.idRangeOffsets.Add(ro);
                }
            }