コード例 #1
0
            public static BaseArrayTable CreateFrom(BinaryReader reader, long beginAt, ushort classCount)
            {
                reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
                //---
                var    baseArrTable = new BaseArrayTable();
                ushort baseCount    = reader.ReadUInt16();

                baseArrTable.records = new BaseRecord[baseCount];
                // Read all baseAnchorOffsets in one go
                ushort[] baseAnchorOffsets = Utils.ReadUInt16Array(reader, classCount * baseCount);
                for (int i = 0; i < baseCount; ++i)
                {
                    BaseRecord baseRec = new BaseRecord(classCount);

                    //each base has anchor point for mark glyph'class
                    for (int n = 0; n < classCount; ++n)
                    {
                        ushort offset = baseAnchorOffsets[i * classCount + n];
                        if (offset <= 0)
                        {
                            //TODO: review here
                            //bug?
                            continue;
                        }
                        baseRec.anchors[n] = AnchorPoint.CreateFrom(reader, beginAt + offset);
                    }

                    baseArrTable.records[i] = baseRec;
                }
                return(baseArrTable);
            }
コード例 #2
0
            public static LookupType4Format1SubTable Load(BigEndianBinaryReader reader, long offset, LookupFlags lookupFlags)
            {
                // MarkBasePosFormat1 Subtable.
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | Type               |  Name                           | Description                                          |
                // +====================+=================================+======================================================+
                // | uint16             | posFormat                       | Format identifier: format = 1                        |
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | Offset16           | markCoverageOffset              | Offset to markCoverage table,                        |
                // |                    |                                 | from beginning of MarkBasePos subtable.              |
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | Offset16           | baseCoverageOffset              | Offset to baseCoverage table,                        |
                // |                    |                                 | from beginning of MarkBasePos subtable.              |
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | uint16             | markClassCount                  | Number of classes defined for marks.                 |
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | Offset16           | markArrayOffset                 | Offset to MarkArray table,                           |
                // |                    |                                 | from beginning of MarkBasePos subtable.              |
                // +--------------------+---------------------------------+------------------------------------------------------+
                // | Offset16           | baseArrayOffset                 | Offset to BaseArray table,                           |
                // |                    |                                 | from beginning of MarkBasePos subtable.              |
                // +--------------------+---------------------------------+------------------------------------------------------+
                ushort markCoverageOffset = reader.ReadOffset16();
                ushort baseCoverageOffset = reader.ReadOffset16();
                ushort markClassCount     = reader.ReadUInt16();
                ushort markArrayOffset    = reader.ReadOffset16();
                ushort baseArrayOffset    = reader.ReadOffset16();

                var markCoverage   = CoverageTable.Load(reader, offset + markCoverageOffset);
                var baseCoverage   = CoverageTable.Load(reader, offset + baseCoverageOffset);
                var markArrayTable = new MarkArrayTable(reader, offset + markArrayOffset);
                var baseArrayTable = new BaseArrayTable(reader, offset + baseArrayOffset, markClassCount);

                return(new LookupType4Format1SubTable(markCoverage, baseCoverage, markArrayTable, baseArrayTable, lookupFlags));
            }
コード例 #3
0
 public LookupType4Format1SubTable(
     CoverageTable markCoverage,
     CoverageTable baseCoverage,
     MarkArrayTable markArrayTable,
     BaseArrayTable baseArrayTable,
     LookupFlags lookupFlags)
     : base(lookupFlags)
 {
     this.markCoverage   = markCoverage;
     this.baseCoverage   = baseCoverage;
     this.markArrayTable = markArrayTable;
     this.baseArrayTable = baseArrayTable;
 }
コード例 #4
0
ファイル: GPOS.Others.cs プロジェクト: cs-phillips/PixelFarm
            public static BaseArrayTable CreateFrom(BinaryReader reader, long beginAt, ushort classCount)
            {
                reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
                //---
                var    baseArrTable = new BaseArrayTable();
                ushort baseCount    = reader.ReadUInt16();

                BaseRecord[] baseRecs = baseArrTable.records = new BaseRecord[baseCount];
                for (int i = 0; i < baseCount; ++i)
                {
                    baseArrTable.records[i] = new BaseRecord(Utils.ReadInt16Array(reader, classCount));
                }
                //read anchor table
                for (int i = 0; i < baseCount; ++i)
                {
                    short[] offsets = baseRecs[i].offsets;
#if DEBUG
                    if (classCount != offsets.Length)
                    {
                        throw new NotSupportedException();
                    }
#endif
                    //each base has anchor point for mark glyph'class

                    AnchorPoint[] anchors = baseRecs[i].anchors = new AnchorPoint[classCount];
                    for (int n = 0; n < classCount; ++n)
                    {
                        short offset = offsets[n];
                        if (offset < 0)
                        {
                            //TODO: review here
                            //bug?
                            continue;
                        }
                        anchors[n] = AnchorPoint.CreateFrom(reader, beginAt + offsets[n]);
                    }
                }
                return(baseArrTable);
            }
コード例 #5
0
ファイル: GPOS.Others.cs プロジェクト: prepare/HTML-Renderer
            public static BaseArrayTable CreateFrom(BinaryReader reader, long beginAt, ushort classCount)
            {
                reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
                //---
                var baseArrTable = new BaseArrayTable();

                ushort baseCount = reader.ReadUInt16();
                baseArrTable.records = new BaseRecord[baseCount];
                for (int i = 0; i < baseCount; ++i)
                {
                    baseArrTable.records[i] = new BaseRecord(Utils.ReadInt16Array(reader, classCount));
                }

                return baseArrTable;
            }