Example #1
0
        private IGlyphTransformationTable ParseCoverageChainingSubstitutionTable(int subTableOffset, dynamic fontTable, LookupFlags lookupFlags)
        {
            var     type  = typeof(GlyphTypeface).Assembly.GetType("MS.Internal.Shaping.CoverageChainingSubtable");
            dynamic table = new AccessPrivateWrapper(TypeExtensions.Instantiate(type, fontTable.Wrapped, subTableOffset));

            dynamic contextualLookupTable = new AccessPrivateWrapper(table.ContextualLookups(fontTable.Wrapped));

            return(new ChainingCoverageContextSubstitutionTable
            {
                LookbackCoverages = this.GetEnumerableFromInternalList(
                    () => table.BacktrackGlyphCount(fontTable.Wrapped),
                    i => (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.BacktrackCoverage(fontTable.Wrapped, i)))).ToList(),
                ContextCoverages = this.GetEnumerableFromInternalList(
                    () => table.InputGlyphCount(fontTable.Wrapped),
                    i => (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.InputCoverage(fontTable.Wrapped, i)))).ToList(),
                LookaheadCoverages = this.GetEnumerableFromInternalList(
                    () => table.LookaheadGlyphCount(fontTable.Wrapped),
                    i => (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.LookaheadCoverage(fontTable.Wrapped, i)))).ToList(),
                TransformationSets = this.GetEnumerableFromInternalList(
                    () => contextualLookupTable.recordCount,
                    i => new ContextTransformationSet
                {
                    FirstGlyphIndex = contextualLookupTable.SequenceIndex(fontTable.Wrapped, i),
                    Transformations = this.GetTransformationTablesByLookupIndex(fontTable, contextualLookupTable.LookupIndex(fontTable.Wrapped, i))
                }).ToList(),
                LookupFlags = lookupFlags
            });
        }