Ejemplo n.º 1
0
            public void Read(TTFReader r, bool readformat = false)
            {
                if (readformat == true)
                {
                    r.ReadInt(out this.format);
                }
                else
                {
                    this.format = 6;
                }

                r.ReadInt(out this.length);
                r.ReadInt(out this.firstCode);
                r.ReadInt(out this.entryCount);

                const int knownTableSz =
                    2 + // format
                    2 + // length
                    2 + // language
                    2 + // firstCode
                    2;  // entryCount

                int glyphsCt = (length - knownTableSz) / 2;

                this.glyphIdArray = new List <ushort>();
                for (int i = 0; i < glyphsCt; ++i)
                {
                    this.glyphIdArray.Add(r.ReadUInt16());
                }
            }
Ejemplo n.º 2
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);
                }
            }
Ejemplo n.º 3
0
 public void Read(TTFReader r)
 {
     r.ReadInt(out this.firstCode);
     r.ReadInt(out this.entryCount);
     r.ReadInt(out this.idDelta);
     r.ReadInt(out this.idRangeOffset);
 }
Ejemplo n.º 4
0
            Dictionary <uint, uint> CharacterConversionMap.MapCodeToIndex(TTFReader r)
            {
                // !UNIMPLEMENTED
                Dictionary <uint, uint> ret = new Dictionary <uint, uint>();

                return(ret);
            }
Ejemplo n.º 5
0
            public ushort postScriptNameID;     // Optional.The name ID for entries in the 'name' table that provide PostScript names for this instance.

            public void Read(TTFReader r, int axisCount)
            {
                r.ReadInt(out this.subfamiltyNameID);
                r.ReadInt(out this.flags);
                this.coordinates.Read(r, axisCount);
                r.ReadInt(out this.postScriptNameID);
            }
Ejemplo n.º 6
0
            public byte yEndRatio;      // Ending y-Ratio value.

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.bCharSet);
                r.ReadInt(out this.xRatio);
                r.ReadInt(out this.yStartRatio);
                r.ReadInt(out this.yEndRatio);
            }
Ejemplo n.º 7
0
        public List <SegmentMap> axisSegmentMap; // The segment maps array — one segment map for each axis, in the order of axes specified in the 'fvar' table.

        public void Read(TTFReader r)
        {
            r.ReadInt(out this.majorVersion);
            r.ReadInt(out this.minorVersion);
            r.ReadInt(out reserved);
            r.ReadInt(out axisCount);

            this.axisSegmentMap = new List <SegmentMap>();
            for (int i = 0; i < this.axisCount; ++i)
            {
                SegmentMap sm = new SegmentMap();
                sm.axisValueMaps = new List <AxisValueMap>();

                r.ReadInt(out sm.positionMapCount);
                for (int j = 0; j < sm.positionMapCount; ++j)
                {
                    AxisValueMap avm = new AxisValueMap();

                    avm.fromCoordinate = r.ReadFDot14();
                    avm.toCoordinate   = r.ReadFDot14();

                    sm.axisValueMaps.Add(avm);
                }

                this.axisSegmentMap.Add(sm);
            }
        }
Ejemplo n.º 8
0
        public List <LangTagRecord> langTagRecord;  // The language-tag records where langTagCount is the number of records.

        public void Read(TTFReader r)
        {
            r.ReadInt(out this.version);
            r.ReadInt(out this.count);
            r.ReadInt(out this.storageOffset);

            this.nameRecord = new List <NameRecords>();
            for (int i = 0; i < this.count; ++i)
            {
                NameRecords nr = new NameRecords();
                nr.Read(r);
                this.nameRecord.Add(nr);
            }

            if (this.version == 1)
            {
                r.ReadInt(out this.langTagCount);
                this.langTagRecord = new List <LangTagRecord>();

                for (int i = 0; i < this.langTagCount; ++i)
                {
                    LangTagRecord ltr = new LangTagRecord();
                    r.ReadInt(out ltr.length);
                    r.ReadInt(out ltr.langTagOffset);
                    this.langTagRecord.Add(ltr);
                }
            }

            // There's more data in the header we could load, but it's being
            // ignored for now.
        }
Ejemplo n.º 9
0
            public void Read(TTFReader r, bool readFormat)
            {
                if (readFormat == true)
                {
                    r.ReadInt(out this.substFormat);
                }

                r.ReadInt(out this.coverageOffset);
                r.ReadInt(out this.backtrackGlyphCount);

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

                r.ReadInt(out this.lookaheadGlyphCount);
                r.ReadInt(out this.glyphCount);

                this.substituteGlyphIDs = new List <ushort>();
                for (int i = 0; i < this.glyphCount; ++i)
                {
                    this.substituteGlyphIDs.Add(r.ReadUInt16());
                }
            }
Ejemplo n.º 10
0
            public List <ushort>    glyphIdArray;  // Variable-length array containing subarrays used for mapping the low byte of 2-byte characters.

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

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

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

                // !NOTE: This parser is unfinished - don't feel like decrypting the documentation
                // on how to get the sizes for this.
                // this.subHeaders = new List<SubHeader>();
                //
                // this.glyphIdArray = new List<ushort>();
            }
Ejemplo n.º 11
0
 public void Read(TTFReader r)
 {
     r.ReadInt(out this.version);
     r.ReadInt(out this.length);
     r.ReadInt(out this.flags);
     r.ReadInt(out this.format);
 }
Ejemplo n.º 12
0
 public void Read(TTFReader r, int offsets)
 {
     this.mark2AnchorOffsets = new List <ushort>();
     for (int i = 0; i < offsets; ++i)
     {
         mark2AnchorOffsets.Add(r.ReadUInt16());
     }
 }
Ejemplo n.º 13
0
 public void Read(TTFReader r, int markClassCount)
 {
     this.ligatureAnchorOffsets = new List <ushort>();
     for (int i = 0; i < markClassCount; ++i)
     {
         this.ligatureAnchorOffsets.Add(r.ReadUInt16());
     }
 }
Ejemplo n.º 14
0
 public void Read(TTFReader r, int n)
 {
     this.values = new List <short>();
     for (int i = 0; i < n; ++i)
     {
         this.values.Add(r.ReadInt16());
     }
 }
Ejemplo n.º 15
0
            public ValueRecord valueRecord2;        // Positioning for second glyph — empty if valueFormat2 = 0.

            public void Read(TTFReader r)
            {
                this.valueRecord1 = new ValueRecord();
                this.valueRecord1.Read(r);

                this.valueRecord2 = new ValueRecord();
                this.valueRecord2.Read(r);
            }
Ejemplo n.º 16
0
            public ushort       axisNameID;           // The name ID for entries in the 'name' table that provide a display name for this axis.

            public void Read(TTFReader r)
            {
                this.axisTag      = r.ReadString(4);
                this.minValue     = r.ReadFixed();
                this.defaultValue = r.ReadFixed();
                this.maxValue     = r.ReadFixed();
                r.ReadInt(out this.flags);
                r.ReadInt(out this.axisNameID);
            }
Ejemplo n.º 17
0
            public List <ushort> ligatureAttachOffsets; // Array of offsets to LigatureAttach tables. Offsets are from beginning of LigatureArray table, ordered by ligatureCoverage index.

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.ligatureCount);
                this.ligatureAttachOffsets = new List <ushort>();
                for (int i = 0; i < this.ligatureCount; ++i)
                {
                    this.ligatureAttachOffsets.Add(r.ReadUInt16());
                }
            }
Ejemplo n.º 18
0
            public List <ushort> alternateGlyphIDs; // Array of alternate glyph IDs, in arbitrary order

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.glyphCount);
                this.alternateGlyphIDs = new List <ushort>();
                for (int i = 0; i < this.glyphCount; ++i)
                {
                    this.alternateGlyphIDs.Add(r.ReadUInt16());
                }
            }
Ejemplo n.º 19
0
            public ushort stringOffset;     // String offset from start of storage area (in bytes).

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.platformID);
                r.ReadInt(out this.encodingID);
                r.ReadInt(out this.languageID);
                r.ReadInt(out this.nameID);
                r.ReadInt(out this.length);
                r.ReadInt(out this.stringOffset);
            }
Ejemplo n.º 20
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);
                }
            }
Ejemplo n.º 21
0
            public short  deltaGlyphID;         // Add to original glyph ID to get substitute glyph ID

            public void Read(TTFReader r, bool readFormat)
            {
                if (readFormat == true)
                {
                    r.ReadInt(out this.substFormat);
                }

                r.ReadInt(out this.coverageOffset);
                r.ReadInt(out this.deltaGlyphID);
            }
Ejemplo n.º 22
0
            public List <ushort> pointIndices;      // Array of contour point indices -in increasing numerical order

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.pointCount);

                this.pointIndices = new List <ushort>();
                for (int i = 0; i < this.pointCount; ++i)
                {
                    this.pointIndices.Add(r.ReadUInt16());
                }
            }
Ejemplo n.º 23
0
            public ValueRecord valueRecord2;    // Positioning data for the second glyph in the pair.

            public void Read(TTFReader r)
            {
                r.ReadInt(out this.secondGlyph);

                this.valueRecord1 = new ValueRecord();
                this.valueRecord1.Read(r);

                this.valueRecord2 = new ValueRecord();
                this.valueRecord2.Read(r);
            }
Ejemplo n.º 24
0
            List <Class2Record> class2Record;    // Array of Class2 records, ordered by classes in classDef2.

            public void Read(TTFReader r, int class2Count)
            {
                this.class2Record = new List <Class2Record>();
                for (int i = 0; i < class2Count; ++i)
                {
                    Class2Record c2r = new Class2Record();
                    c2r.Read(r);
                    this.class2Record.Add(c2r);
                }
            }
Ejemplo n.º 25
0
            public short  yCoordinate;          // Vertical value, in design units

            public void Read(TTFReader r, bool readFormat)
            {
                if (readFormat == true)
                {
                    r.ReadInt(out this.anchorFormat);
                }

                r.ReadInt(out this.xCoordinate);
                r.ReadInt(out this.yCoordinate);
            }
Ejemplo n.º 26
0
            public uint   extensionOffset;          // Offset to the extension subtable, of lookup type extensionLookupType, relative to the start of the ExtensionSubstFormat1 subtable.

            public void Read(TTFReader r, bool readFormat)
            {
                if (readFormat == true)
                {
                    r.ReadInt(out this.substFormat);
                }

                r.ReadInt(out this.extensionLookupType);
                r.ReadInt(out this.extensionOffset);
            }
Ejemplo n.º 27
0
        public void Read(TTFReader r)
        {
            r.ReadInt(out this.majorVersion);
            r.ReadInt(out this.minorVersion);
            r.ReadInt(out this.scriptListOffset);
            r.ReadInt(out this.featureListOffset);
            r.ReadInt(out this.lookupListOffset);
            r.ReadInt(out this.featureVariableOffset);

            // The rest of the data is skipped for now
        }
Ejemplo n.º 28
0
 public void Read(TTFReader r, int markClassCount)
 {
     r.ReadInt(out this.baseCount);
     this.baseRecord = new List <BaseRecord>();
     for (int i = 0; i < this.baseCount; ++i)
     {
         BaseRecord br = new BaseRecord();
         br.Read(r, markClassCount);
         baseRecord.Add(br);
     }
 }
Ejemplo n.º 29
0
            Dictionary <uint, uint> CharacterConversionMap.MapCodeToIndex(TTFReader r)
            {
                Dictionary <uint, uint> ret = new Dictionary <uint, uint>();

                for (uint i = 0; i < (uint)this.glyphIdArray.Count; ++i)
                {
                    ret[i] = this.glyphIdArray[(int)i];
                }

                return(ret);
            }
Ejemplo n.º 30
0
            public ushort yAdvDeviceOffset;        // Offset to Device table (non-variable font) / VariationIndex table (variable font) for vertical advance, from beginning of the immediate parent table (SinglePos or PairPosFormat2 lookup subtable, PairSet table within a PairPosFormat1 lookup subtable) — may be NULL.


            public void Read(TTFReader r)
            {
                r.ReadInt(out this.xPlacement);
                r.ReadInt(out this.yPlacement);
                r.ReadInt(out this.xAdvance);
                r.ReadInt(out this.yAdvance);
                r.ReadInt(out this.xPlaDeviceOffset);
                r.ReadInt(out this.yPlaDeviceOffset);
                r.ReadInt(out this.xAdvDeviceOffset);
                r.ReadInt(out this.yAdvDeviceOffset);
            }