private IGlyphTransformationTable ParseClassChainingSubstitutionTable(int subTableOffset, dynamic fontTable, LookupFlags lookupFlags) { var type = typeof(GlyphTypeface).Assembly.GetType("MS.Internal.Shaping.ClassChainingSubtable"); 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(); var LookbackClassDefinition = fontTable.GetUShort(table.offset + table.offsetBacktrackClassDef) == 0 ? RangeGlyphClassDefinition.CreateEmptyClassDef() : this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.BacktrackClassDef(fontTable.Wrapped))); var ContextClassDefinitions = this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.InputClassDef(fontTable.Wrapped))); var LookaheadClassDefinition = fontTable.GetUShort(table.offset + table.offsetLookaheadClassDef) == 0 ? RangeGlyphClassDefinition.CreateEmptyClassDef() : this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.LookaheadClassDef(fontTable.Wrapped))); return(new ChainingClassContextTransformationTable { Coverage = coverageTable, LookbackClassDefinition = fontTable.GetUShort(table.offset + table.offsetBacktrackClassDef) == 0 ? RangeGlyphClassDefinition.CreateEmptyClassDef() : this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.BacktrackClassDef(fontTable.Wrapped))), ContextClassDefinitions = this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.InputClassDef(fontTable.Wrapped))), LookaheadClassDefinition = fontTable.GetUShort(table.offset + table.offsetLookaheadClassDef) == 0 ? RangeGlyphClassDefinition.CreateEmptyClassDef() : this.ParseClassDef(fontTable, new AccessPrivateWrapper(table.LookaheadClassDef(fontTable.Wrapped))), TransformationRules = ruleSetTables .Select( ruleSetTable => ruleSetTable.IsNull ? Enumerable.Empty <ChainingContextTransformationRule>() : this.GetEnumerableFromInternalList( () => ruleSetTable.RuleCount(fontTable.Wrapped), i => (ChainingContextTransformationRule)this.ParseChainingTransformationRule( fontTable, new AccessPrivateWrapper(ruleSetTable.Rule(fontTable.Wrapped, i)), (Func <dynamic, int, ushort>)((ruleTable, index) => (ushort)ruleTable.ClassId(fontTable.Wrapped, index)), (ushort)i)).ToList()).ToList(), LookupFlags = lookupFlags }); }