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

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

            var ruleSetTables = this.GetEnumerableFromInternalList(
                () => (ushort)table.ClassSetCount(fontTable.Wrapped),
                i => (dynamic) new AccessPrivateWrapper(table.ClassSet(fontTable.Wrapped, i))).ToList();

            return(new ClassContextTransformationTable
            {
                Coverage = coverageTable,
                ClassDefinitions = this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.ClassDef(fontTable.Wrapped))),
                TransformationRules = ruleSetTables
                                      .Select(
                    ruleSetTable =>
                    ruleSetTable.IsNull ?
                    Enumerable.Empty <ContextTransformationRule>() :
                    this.GetEnumerableFromInternalList(
                        () => ruleSetTable.RuleCount(fontTable.Wrapped),
                        i => (ContextTransformationRule)this.ParseContextTransformationRule(
                            fontTable,
                            new AccessPrivateWrapper(ruleSetTable.Rule(fontTable.Wrapped, i)),
                            (Func <dynamic, int, ushort>)((ruleTable, index) => (ushort)ruleTable.ClassId(fontTable.Wrapped, index)))).ToList()).ToList(),
                LookupFlags = lookupFlags
            });
        }