sl@0: /* sl@0: * sl@0: * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved sl@0: * sl@0: */ sl@0: sl@0: #include "LETypes.h" sl@0: #include "LEGlyphFilter.h" sl@0: #include "OpenTypeTables.h" sl@0: #include "GlyphSubstitutionTables.h" sl@0: #include "AlternateSubstSubtables.h" sl@0: #include "GlyphIterator.h" sl@0: #include "LESwaps.h" sl@0: sl@0: U_NAMESPACE_BEGIN sl@0: sl@0: le_uint32 AlternateSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const sl@0: { sl@0: // NOTE: For now, we'll just pick the first alternative... sl@0: LEGlyphID glyph = glyphIterator->getCurrGlyphID(); sl@0: le_int32 coverageIndex = getGlyphCoverage(glyph); sl@0: sl@0: if (coverageIndex >= 0) { sl@0: le_uint16 altSetCount = SWAPW(alternateSetCount); sl@0: sl@0: if (coverageIndex < altSetCount) { sl@0: Offset alternateSetTableOffset = SWAPW(alternateSetTableOffsetArray[coverageIndex]); sl@0: const AlternateSetTable *alternateSetTable = sl@0: (const AlternateSetTable *) ((char *) this + alternateSetTableOffset); sl@0: TTGlyphID alternate = SWAPW(alternateSetTable->alternateArray[0]); sl@0: sl@0: if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, alternate))) { sl@0: glyphIterator->setCurrGlyphID(SWAPW(alternateSetTable->alternateArray[0])); sl@0: } sl@0: sl@0: return 1; sl@0: } sl@0: sl@0: // XXXX If we get here, the table's mal-formed... sl@0: } sl@0: sl@0: return 0; sl@0: } sl@0: sl@0: U_NAMESPACE_END