Esempio n. 1
0
        private IGlyphTransformationTable ParseMarkToBasePositioningTable(int subTableOffset, dynamic fontTable, LookupFlags lookupFlags)
        {
            var     type   = typeof(GlyphTypeface).Assembly.GetType("MS.Internal.Shaping.MarkToBasePositioningSubtable");
            dynamic table  = new AccessPrivateWrapper(type.Instantiate(subTableOffset));
            ushort  format = table.Format(fontTable.Wrapped);

            if (format != 1)
            {
                throw new UnknownTableFormatException(type, format);
            }

            dynamic markArrayTable = new AccessPrivateWrapper(table.Marks(fontTable.Wrapped));
            dynamic baseArrayTable = new AccessPrivateWrapper(table.Bases(fontTable.Wrapped));

            return(new MarkToBasePositioningTable
            {
                MarkCoverage = (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.MarkCoverage(fontTable.Wrapped))),
                BaseCoverage = (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.BaseCoverage(fontTable.Wrapped))),
                MarkAnchorPoints = this.GetEnumerableFromInternalList(
                    () => fontTable.GetUShort(markArrayTable.offset),
                    i =>
                    new Tuple <ushort, AnchorPoint>(
                        (ushort)markArrayTable.Class(fontTable.Wrapped, i),
                        (AnchorPoint)this.ParseAnchor(fontTable, new AccessPrivateWrapper(markArrayTable.MarkAnchor(fontTable.Wrapped, i)))
                        )).ToList(),
                BaseAnchorPoints = this.GetEnumerableFromInternalList(
                    () => fontTable.GetUShort(baseArrayTable.offset),
                    i => this.GetEnumerableFromInternalList(
                        () => table.ClassCount(fontTable.Wrapped),
                        j => (AnchorPoint)this.ParseAnchor(fontTable, new AccessPrivateWrapper(baseArrayTable.BaseAnchor(fontTable.Wrapped, i, table.ClassCount(fontTable.Wrapped), j)))
                        ).ToList()
                    ).ToList(),
                LookupFlags = lookupFlags
            });
        }