private IGlyphTransformationTable ParseLigatureSubstitutionTable(int subTableOffset, dynamic fontTable, LookupFlags lookupFlags) { var type = typeof(GlyphTypeface).Assembly.GetType("MS.Internal.Shaping.LigatureSubstitutionSubtable"); dynamic table = new AccessPrivateWrapper(type.Instantiate(subTableOffset)); ushort format = table.Format(fontTable.Wrapped); if (format != 1) { throw new UnknownTableFormatException(type, format); } var ligatureSetTables = this.GetEnumerableFromInternalList( () => table.LigatureSetCount(fontTable.Wrapped), i => (dynamic) new AccessPrivateWrapper(table.LigatureSet(fontTable.Wrapped, i))).ToList(); var ligatures = ligatureSetTables .Select( ligatureSetTable => this.GetEnumerableFromInternalList( () => ligatureSetTable.LigatureCount(fontTable.Wrapped), i => (dynamic) new AccessPrivateWrapper(ligatureSetTable.Ligature(fontTable.Wrapped, i))) .Select( ligatureTable => new Ligature { LigatureGlyphId = (ushort)ligatureTable.LigatureGlyph(fontTable.Wrapped), ComponentGlyphIds = this.GetEnumerableFromInternalList( () => (ushort)(ligatureTable.ComponentCount(fontTable.Wrapped) - 1), i => (ushort)ligatureTable.Component(fontTable.Wrapped, (ushort)(i + 1))) }).ToList()).ToList(); return(new LigatureSubstitutionTable { Coverage = this.ParseCoverageTable(fontTable, new AccessPrivateWrapper(table.Coverage(fontTable.Wrapped))), LigatureSets = ligatures.ToList(), LookupFlags = lookupFlags }); }