1 /* 2 * 3 * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved 4 * 5 */ 6 7 #include "LETypes.h" 8 #include "LEGlyphFilter.h" 9 #include "LEFontInstance.h" 10 #include "OpenTypeTables.h" 11 #include "ICUFeatures.h" 12 #include "Lookups.h" 13 #include "ScriptAndLanguage.h" 14 #include "GlyphDefinitionTables.h" 15 #include "GlyphSubstitutionTables.h" 16 #include "SingleSubstitutionSubtables.h" 17 #include "MultipleSubstSubtables.h" 18 #include "AlternateSubstSubtables.h" 19 #include "LigatureSubstSubtables.h" 20 #include "ContextualSubstSubtables.h" 21 #include "ExtensionSubtables.h" 22 #include "LookupProcessor.h" 23 #include "GlyphSubstLookupProc.h" 24 #include "LESwaps.h" 25 26 U_NAMESPACE_BEGIN 27 28 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor( 29 const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader, 30 LETag scriptTag, 31 LETag languageTag, 32 const LEGlyphFilter *filter, 33 const FeatureMap *featureMap, 34 le_int32 featureMapCount, 35 le_bool featureOrder, 36 LEErrorCode& success) 37 : LookupProcessor( 38 (char *) glyphSubstitutionTableHeader, 39 SWAPW(glyphSubstitutionTableHeader->scriptListOffset), 40 SWAPW(glyphSubstitutionTableHeader->featureListOffset), 41 SWAPW(glyphSubstitutionTableHeader->lookupListOffset), 42 scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success), fFilter(filter) 43 { 44 // anything? 45 } 46 47 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor() 48 { 49 } 50 51 le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType, 52 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const 53 { 54 if (LE_FAILURE(success)) { 55 return 0; 56 } 57 58 le_uint32 delta = 0; 59 60 switch(lookupType) 61 { 62 case 0: 63 break; 64 65 case gsstSingle: 66 { 67 const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable; 68 69 delta = subtable->process(glyphIterator, fFilter); 70 break; 71 } 72 73 case gsstMultiple: 74 { 75 const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable; 76 77 delta = subtable->process(glyphIterator, success, fFilter); 78 break; 79 } 80 81 case gsstAlternate: 82 { 83 const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable; 84 85 delta = subtable->process(glyphIterator, fFilter); 86 break; 87 } 88 89 case gsstLigature: 90 { 91 const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable; 92 93 delta = subtable->process(glyphIterator, fFilter); 94 break; 95 } 96 97 case gsstContext: 98 { 99 const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable; 100 101 delta = subtable->process(this, glyphIterator, fontInstance, success); 102 break; 103 } 104 105 case gsstChainingContext: 106 { 107 const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable; 108 109 delta = subtable->process(this, glyphIterator, fontInstance, success); 110 break; 111 } 112 113 case gsstExtension: 114 { 115 const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; 116 117 delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success); 118 break; 119 } 120 121 default: 122 break; 123 } 124 125 return delta; 126 } 127 128 GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor() 129 { 130 } 131 132 U_NAMESPACE_END 133