1 /* 2 * (C) Copyright IBM Corp. 1998 - 2013 - All Rights Reserved 3 * 4 */ 5 6 #include "LETypes.h" 7 #include "LEFontInstance.h" 8 #include "OpenTypeTables.h" 9 #include "ICUFeatures.h" 10 #include "Lookups.h" 11 #include "ScriptAndLanguage.h" 12 #include "GlyphDefinitionTables.h" 13 #include "GlyphPositioningTables.h" 14 #include "SinglePositioningSubtables.h" 15 #include "PairPositioningSubtables.h" 16 #include "CursiveAttachmentSubtables.h" 17 #include "MarkToBasePosnSubtables.h" 18 #include "MarkToLigaturePosnSubtables.h" 19 #include "MarkToMarkPosnSubtables.h" 20 //#include "ContextualPositioningSubtables.h" 21 #include "ContextualSubstSubtables.h" 22 #include "ExtensionSubtables.h" 23 #include "LookupProcessor.h" 24 #include "GlyphPosnLookupProc.h" 25 #include "LESwaps.h" 26 27 U_NAMESPACE_BEGIN 28 29 // Aside from the names, the contextual positioning subtables are 30 // the same as the contextual substitution subtables. 31 typedef ContextualSubstitutionSubtable ContextualPositioningSubtable; 32 typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable; 33 34 GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor( 35 const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader, 36 LETag scriptTag, 37 LETag languageTag, 38 const FeatureMap *featureMap, 39 le_int32 featureMapCount, 40 le_bool featureOrder, 41 LEErrorCode& success) 42 : LookupProcessor( 43 glyphPositioningTableHeader, 44 SWAPW(glyphPositioningTableHeader->scriptListOffset), 45 SWAPW(glyphPositioningTableHeader->featureListOffset), 46 SWAPW(glyphPositioningTableHeader->lookupListOffset), 47 scriptTag, 48 languageTag, 49 featureMap, 50 featureMapCount, 51 featureOrder, 52 success 53 ) 54 { 55 // anything? 56 } 57 58 GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor() 59 { 60 } 61 62 le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType, 63 GlyphIterator *glyphIterator, 64 const LEFontInstance *fontInstance, 65 LEErrorCode& success) const 66 { 67 if (LE_FAILURE(success)) { 68 return 0; 69 } 70 71 le_uint32 delta = 0; 72 73 switch(lookupType) 74 { 75 case 0: 76 break; 77 78 case gpstSingle: 79 { 80 LEReferenceTo<SinglePositioningSubtable> subtable(lookupSubtable, success); 81 82 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 83 break; 84 } 85 86 case gpstPair: 87 { 88 LEReferenceTo<PairPositioningSubtable> subtable(lookupSubtable, success); 89 90 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 91 break; 92 } 93 94 case gpstCursive: 95 { 96 LEReferenceTo<CursiveAttachmentSubtable> subtable(lookupSubtable, success); 97 98 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 99 break; 100 } 101 102 case gpstMarkToBase: 103 { 104 LEReferenceTo<MarkToBasePositioningSubtable> subtable(lookupSubtable, success); 105 106 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 107 break; 108 } 109 110 case gpstMarkToLigature: 111 { 112 LEReferenceTo<MarkToLigaturePositioningSubtable> subtable(lookupSubtable, success); 113 114 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 115 break; 116 } 117 118 case gpstMarkToMark: 119 { 120 LEReferenceTo<MarkToMarkPositioningSubtable> subtable(lookupSubtable, success); 121 122 delta = subtable->process(subtable, glyphIterator, fontInstance, success); 123 break; 124 } 125 126 case gpstContext: 127 { 128 LEReferenceTo<ContextualPositioningSubtable> subtable(lookupSubtable, success); 129 130 delta = subtable->process(this, glyphIterator, fontInstance, success); 131 break; 132 } 133 134 case gpstChainedContext: 135 { 136 LEReferenceTo<ChainingContextualPositioningSubtable> subtable(lookupSubtable, success); 137 138 delta = subtable->process(this, glyphIterator, fontInstance, success); 139 break; 140 } 141 142 case gpstExtension: 143 { 144 LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success); 145 146 delta = subtable->process(this, subtable, lookupType, glyphIterator, fontInstance, success); // Google patch: add subtable 147 break; 148 } 149 150 default: 151 break; 152 } 153 154 return delta; 155 } 156 157 GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor() 158 { 159 } 160 161 U_NAMESPACE_END 162