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

            var coverageTable = (ICoverageTable)this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.Coverage(fontTable.Wrapped)));

            var ruleSetTables = this.GetEnumerableFromInternalList(
                () => (ushort)coverageTable.CoveredGlyphIds.Count(),
                i => (dynamic) new AccessPrivateWrapper(table.RuleSet(fontTable.Wrapped, i))).ToList();

            return(new ChainingGlyphContextTransformationTable
            {
                Coverage = coverageTable,
                TransformationRules = ruleSetTables
                                      .Select(
                    ruleSetTable => this.GetEnumerableFromInternalList(
                        () => ruleSetTable.RuleCount(fontTable.Wrapped),
                        i => (ChainingContextTransformationRule)this.ParseChainingTransformationRule(
                            fontTable,
                            new AccessPrivateWrapper(table.Rule(fontTable.Wrapped, i)),
                            (Func <dynamic, int, ushort>)((ruleTable, index) => (ushort)ruleTable.GlyphId(fontTable.Wrapped, index)),
                            coverageTable.CoveredGlyphIds[i])).ToList()).ToList(),
                LookupFlags = lookupFlags
            });
        }