3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
8 #include "LEGlyphFilter.h"
9 #include "OpenTypeTables.h"
10 #include "GlyphSubstitutionTables.h"
11 #include "AlternateSubstSubtables.h"
12 #include "GlyphIterator.h"
17 le_uint32 AlternateSubstitutionSubtable::process(const LEReferenceTo<AlternateSubstitutionSubtable> &base,
18 GlyphIterator *glyphIterator, LEErrorCode &success, const LEGlyphFilter *filter) const
20 // NOTE: For now, we'll just pick the first alternative...
21 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
22 le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
24 if (coverageIndex >= 0 && LE_SUCCESS(success)) {
25 le_uint16 altSetCount = SWAPW(alternateSetCount);
27 if (coverageIndex < altSetCount) {
28 Offset alternateSetTableOffset = SWAPW(alternateSetTableOffsetArray[coverageIndex]);
29 const LEReferenceTo<AlternateSetTable> alternateSetTable(base, success,
30 (const AlternateSetTable *) ((char *) this + alternateSetTableOffset));
31 TTGlyphID alternate = SWAPW(alternateSetTable->alternateArray[0]);
33 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, alternate))) {
34 glyphIterator->setCurrGlyphID(SWAPW(alternateSetTable->alternateArray[0]));
40 // XXXX If we get here, the table's mal-formed...