private IEnumerable <IGlyphTransformationTable> GetTransformationTablesByLookupIndex(dynamic fontTable, ushort lookupIndex) { dynamic fontTableHeader = this.GetFontTableHeader(); dynamic lookupList = new AccessPrivateWrapper(fontTableHeader.GetLookupList(fontTable.Wrapped)); dynamic lookupTable = new AccessPrivateWrapper(lookupList.Lookup(fontTable.Wrapped, lookupIndex)); return(this.GetSubstitutionTablesByLookupTable(fontTable, lookupTable)); }
/// <summary> /// Dumps information about the specified typeface into console output stream. /// </summary> /// <param name="typeface">The typeface.</param> public void Dump(GlyphTypeface typeface) { dynamic fontTable = this.GetFontTable(typeface); dynamic fontTableHeader = this.GetFontTableHeader(); dynamic featureList = new AccessPrivateWrapper(fontTableHeader.GetFeatureList(fontTable.Wrapped)); dynamic lookupList = new AccessPrivateWrapper(fontTableHeader.GetLookupList(fontTable.Wrapped)); for (ushort i = 0; i < featureList.FeatureCount(fontTable.Wrapped); i++) { Console.WriteLine(i + " " + TagConverter.TagFromUint((uint)featureList.FeatureTag(fontTable.Wrapped, i)).Label); dynamic featureTable = new AccessPrivateWrapper(featureList.FeatureTable(fontTable.Wrapped, i)); for (ushort j = 0; j < featureTable.LookupCount(fontTable.Wrapped); j++) { dynamic lookupTable = new AccessPrivateWrapper(lookupList.Lookup(fontTable.Wrapped, featureTable.LookupIndex(fontTable.Wrapped, j))); var lookupFlags = (LookupFlags)lookupTable.LookupFlags(); var substitutionLookupType = (PositioningLookupType)lookupTable.LookupType(); Console.Write( "\t" + j + " " + lookupTable.offset + " " + featureTable.LookupIndex(fontTable.Wrapped, j) + " " + substitutionLookupType.ToString() + " "); if (substitutionLookupType == PositioningLookupType.ExtensionPositioning) { var type = typeof(GlyphTypeface).Assembly.GetType("MS.Internal.Shaping.ExtensionLookupTable"); var subTables = this.GetEnumerableFromInternalList( () => lookupTable.SubTableCount(), index => (dynamic) new AccessPrivateWrapper(type.Instantiate((ushort)lookupTable.SubtableOffset(fontTable.Wrapped, index)))); Console.Write(" [" + string.Join(", ", subTables.Select(subTable => ((PositioningLookupType)subTable.LookupType(fontTable.Wrapped)).ToString()).Distinct()) + "] "); } Console.Write("("); var flagsStrings = new List <string>(); if ((lookupFlags & LookupFlags.RightToLeft) == LookupFlags.RightToLeft) { flagsStrings.Add("RTL"); } if ((lookupFlags & LookupFlags.IgnoreBaseGlyphs) == LookupFlags.IgnoreBaseGlyphs) { flagsStrings.Add("IgnoreBaseGlyphs"); } if ((lookupFlags & LookupFlags.IgnoreLigatures) == LookupFlags.IgnoreLigatures) { flagsStrings.Add("IgnoreLigatures"); } if ((lookupFlags & LookupFlags.IgnoreMarks) == LookupFlags.IgnoreMarks) { flagsStrings.Add("IgnoreMarks"); } if ((lookupFlags & LookupFlags.UseMarkFilteringSet) == LookupFlags.UseMarkFilteringSet) { flagsStrings.Add("UseMarkFilteringSet"); } if ((lookupFlags & LookupFlags.MarkAttachmentTypeMask) > 0) { flagsStrings.Add("MarkAttachmentTypeMask=" + (lookupFlags & LookupFlags.MarkAttachmentTypeMask)); } Console.WriteLine(string.Join(", ", flagsStrings) + ") x" + lookupTable.SubTableCount()); } } }