1 /* 2 * %W% %E% 3 * 4 * (C) Copyright IBM Corp. 2008-2013 - All Rights Reserved 5 * 6 */ 7 8 #include "LETypes.h" 9 #include "OpenTypeTables.h" 10 #include "GlyphSubstitutionTables.h" 11 #include "LookupProcessor.h" 12 #include "ExtensionSubtables.h" 13 #include "GlyphIterator.h" 14 #include "LESwaps.h" 15 16 U_NAMESPACE_BEGIN 17 18 // read a 32-bit value that might only be 16-bit-aligned in memory 19 static inline le_uint32 READ_LONG(le_uint32 code) { 20 le_uint16* first = ((le_uint16*)&code); 21 le_uint16* second = (((le_uint16*)&code) + 1); 22 return (le_uint32)((SWAPW(*first) << 16) + SWAPW(*second)); 23 } 24 25 // FIXME: should look at the format too... maybe have a sub-class for it? 26 le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, const LETableReference &base, le_uint16 lookupType, // Google patch: add base 27 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const 28 { 29 // Google patch: remove thisRef 30 if (LE_FAILURE(success)) { 31 return 0; 32 } 33 34 le_uint16 elt = SWAPW(extensionLookupType); 35 36 if (elt != lookupType) { 37 le_uint32 extOffset = READ_LONG(extensionOffset); 38 LEReferenceTo<LookupSubtable> subtable(base, success, extOffset); // Google patch: s/thisRef/base/ 39 40 if(LE_SUCCESS(success)) { 41 return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success); 42 } 43 } 44 45 return 0; 46 } 47 48 U_NAMESPACE_END 49