os/textandloc/fontservices/textshaperplugin/IcuSource/layout/AlternateSubstSubtables.cpp
Update contrib.
3 * (C) Copyright IBM Corp. 1998-2004 - 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(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
19 // NOTE: For now, we'll just pick the first alternative...
20 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
21 le_int32 coverageIndex = getGlyphCoverage(glyph);
23 if (coverageIndex >= 0) {
24 le_uint16 altSetCount = SWAPW(alternateSetCount);
26 if (coverageIndex < altSetCount) {
27 Offset alternateSetTableOffset = SWAPW(alternateSetTableOffsetArray[coverageIndex]);
28 const AlternateSetTable *alternateSetTable =
29 (const AlternateSetTable *) ((char *) this + alternateSetTableOffset);
30 TTGlyphID alternate = SWAPW(alternateSetTable->alternateArray[0]);
32 if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, alternate))) {
33 glyphIterator->setCurrGlyphID(SWAPW(alternateSetTable->alternateArray[0]));
39 // XXXX If we get here, the table's mal-formed...