1 /* 2 * 3 * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved 4 * 5 */ 6 7 #include "LETypes.h" 8 #include "LEFontInstance.h" 9 #include "OpenTypeTables.h" 10 #include "GlyphPositioningTables.h" 11 #include "SinglePositioningSubtables.h" 12 #include "ValueRecords.h" 13 #include "GlyphIterator.h" 14 #include "LESwaps.h" 15 16 U_NAMESPACE_BEGIN 17 18 le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const 19 { 20 switch(SWAPW(subtableFormat)) 21 { 22 case 0: 23 return 0; 24 25 case 1: 26 { 27 const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this; 28 29 return subtable->process(glyphIterator, fontInstance); 30 } 31 32 case 2: 33 { 34 const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this; 35 36 return subtable->process(glyphIterator, fontInstance); 37 } 38 39 default: 40 return 0; 41 } 42 } 43 44 le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const 45 { 46 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); 47 le_int32 coverageIndex = getGlyphCoverage(glyph); 48 49 if (coverageIndex >= 0) { 50 valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); 51 52 return 1; 53 } 54 55 return 0; 56 } 57 58 le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const 59 { 60 LEGlyphID glyph = glyphIterator->getCurrGlyphID(); 61 le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph); 62 63 if (coverageIndex >= 0) { 64 valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance); 65 66 return 1; 67 } 68 69 return 0; 70 } 71 72 U_NAMESPACE_END 73