Beispiel #1
0
        public void LoadArrays(TTFReader r)
        {
            r.SetPosition(this.axesArrayOffset);

            this.axes      = new List <VariationAxisRecord>(); // The variation axis array.
            this.instances = new List <InstanceRecord>();      // The named instance array.

            for (int i = 0; i < this.axisCount; ++i)
            {
                VariationAxisRecord v = new VariationAxisRecord();
                v.Read(r);
                this.axes.Add(v);
            }

            for (int i = 0; i < this.instanceCount; ++i)
            {
                InstanceRecord ir = new InstanceRecord();
                ir.Read(r, this.axisCount);
                this.instances.Add(ir);
            }
        }
Beispiel #2
0
            Dictionary <uint, uint> CharacterConversionMap.MapCodeToIndex(TTFReader r)
            {
                Dictionary <uint, uint> ret = new Dictionary <uint, uint>();

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

                for (int i = 0; i < segCt; ++i)
                {
                    // https://gist.github.com/smhanov/f009a02c00eb27d99479a1e37c1b3354

                    int start = this.startCode[i];
                    int end   = this.endCode[i];
                    if (start == 0xffff || end == 0xffff)
                    {
                        break;
                    }

                    uint ro = this.idRangeOffsets[i];

                    if (ro == 0)
                    {
                        for (int j = start; j <= end; ++j)
                        {
                            ret.Add((uint)j, (uint)(j + this.idDelta[i]));
                        }
                    }
                    else
                    {
                        r.SetPosition(ro);
                        for (int j = start; j <= end; ++j)
                        {
                            ret.Add((uint)j, r.ReadUInt16());
                        }
                    }
                }

                return(ret);
            }
Beispiel #3
0
        public void Read(TTFReader r, uint tableStart)
        {
            r.ReadInt(out this.version);
            r.ReadInt(out this.numTables);

            this.encodingRecords = new List <EncodingRecord>();
            for (int i = 0; i < this.numTables; ++i)
            {
                EncodingRecord er = new EncodingRecord();
                er.Read(r);
                this.encodingRecords.Add(er);
            }

            foreach (EncodingRecord rc in this.encodingRecords)
            {
                r.SetPosition(tableStart + rc.subtableOffset);

                ushort format = r.ReadUInt16();

                if (format == 0)
                {
                    if (this.format0 == null)
                    {
                        this.format0 = new List <Format0>();
                    }

                    Format0 f0 = new Format0();
                    f0.Read(r);
                    this.format0.Add(f0);
                }
                else if (format == 2)
                {
                    if (this.format2 == null)
                    {
                        this.format2 = new List <Format2>();
                    }

                    Format2 f2 = new Format2();
                    f2.Read(r);
                    this.format2.Add(f2);
                }
                else if (format == 4)
                {
                    if (this.format4 == null)
                    {
                        this.format4 = new List <Format4>();
                    }

                    Format4 f4 = new Format4();
                    f4.Read(r);
                    this.format4.Add(f4);
                }
                else if (format == 6)
                {
                    if (this.format6 == null)
                    {
                        this.format6 = new List <Format6>();
                    }

                    Format6 f6 = new Format6();
                    f6.Read(r);
                    this.format6.Add(f6);
                }
                else if (format == 8)
                {
                    if (this.format8 == null)
                    {
                        this.format8 = new List <Format8>();
                    }

                    Format8 f8 = new Format8();
                    f8.Read(r);
                    this.format8.Add(f8);
                }
                else if (format == 10)
                {
                    if (this.format10 == null)
                    {
                        this.format10 = new List <Format10>();
                    }

                    Format10 f10 = new Format10();
                    f10.Read(r);
                    this.format10.Add(f10);
                }
                else if (format == 12)
                {
                    if (this.format12 == null)
                    {
                        this.format12 = new List <Format12>();
                    }

                    Format12 f12 = new Format12();
                    f12.Read(r);
                    this.format12.Add(f12);
                }
                else if (format == 13)
                {
                    if (this.format13 == null)
                    {
                        this.format13 = new List <Format13>();
                    }

                    Format13 f13 = new Format13();
                    f13.Read(r);
                    this.format13.Add(f13);
                }
                else if (format == 14)
                {
                    if (this.format14 == null)
                    {
                        this.format14 = new List <Format14>();
                    }

                    Format14 f14 = new Format14();
                    f14.Read(r);
                    this.format14.Add(f14);
                }
            }
        }