示例#1
0
 public unsafe bool Apply(
     IOpenTypeFont           Font,           // Font access interface 
     OpenTypeTags            TableTag,       // Layout table tag (GSUB or GPOS) 
     FontTable               Table,          // Layout table (GSUB or GPOS)
     LayoutMetrics           Metrics,        // LayoutMetrics 
     int                     CharCount,      // Characters count (i.e. Charmap.Length);
     UshortList              Charmap,        // Char to glyph mapping
     GlyphInfoList           GlyphInfo,      // List of GlyphInfo structs
     int*                    Advances,       // Glyph adv.widths 
     LayoutOffset*           Offsets,        // Glyph offsets
     ushort                  LookupFlags,    // Lookup table flags 
     int                     FirstGlyph,     // where to apply it 
     int                     AfterLastGlyph, // how long is a context we can use
     uint                    Parameter,      // lookup parameter 
     int                     nestingLevel,   // Contextual lookup nesting level
     out int                 NextGlyph       // out: next glyph index
     )
 { 
     switch (Format(Table))
     { 
         case 1: 
             GlyphContextSubtable glyphContextSubtable =
                                         new GlyphContextSubtable(offset); 
             return glyphContextSubtable.Apply(
                 Font, TableTag, Table, Metrics,
                 CharCount, Charmap,
                 GlyphInfo, Advances, Offsets, 
                 LookupFlags, FirstGlyph, AfterLastGlyph,
                 Parameter, 
                 nestingLevel, 
                 out NextGlyph
                 ); 
         case 2:
             ClassContextSubtable classContextSubtable =
                                         new ClassContextSubtable(offset);
             return classContextSubtable.Apply( 
                 Font, TableTag, Table, Metrics,
                 CharCount, Charmap, 
                 GlyphInfo, Advances, Offsets, 
                 LookupFlags, FirstGlyph, AfterLastGlyph,
                 Parameter, 
                 nestingLevel,
                 out NextGlyph
                 );
         case 3: 
             CoverageContextSubtable coverageContextSubtable =
                                         new CoverageContextSubtable(offset); 
             return coverageContextSubtable.Apply( 
                 Font, TableTag, Table, Metrics,
                 CharCount, Charmap, 
                 GlyphInfo, Advances, Offsets,
                 LookupFlags, FirstGlyph, AfterLastGlyph,
                 Parameter,
                 nestingLevel, 
                 out NextGlyph
                 ); 
         default: 
             //Unknown format
             NextGlyph = FirstGlyph+1; //don't match 
             return false;
     }
 }