3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
8 #include "LEGlyphFilter.h"
9 #include "OpenTypeTables.h"
10 #include "GlyphSubstitutionTables.h"
11 #include "SingleSubstitutionSubtables.h"
12 #include "GlyphIterator.h"
17 le_uint32
SingleSubstitutionSubtable::process(GlyphIterator
*glyphIterator
, const LEGlyphFilter
*filter
) const
19 switch(SWAPW(subtableFormat
))
26 const SingleSubstitutionFormat1Subtable
*subtable
= (const SingleSubstitutionFormat1Subtable
*) this;
28 return subtable
->process(glyphIterator
, filter
);
33 const SingleSubstitutionFormat2Subtable
*subtable
= (const SingleSubstitutionFormat2Subtable
*) this;
35 return subtable
->process(glyphIterator
, filter
);
43 le_uint32
SingleSubstitutionFormat1Subtable::process(GlyphIterator
*glyphIterator
, const LEGlyphFilter
*filter
) const
45 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
46 le_int32 coverageIndex
= getGlyphCoverage(glyph
);
48 if (coverageIndex
>= 0) {
49 TTGlyphID substitute
= ((TTGlyphID
) LE_GET_GLYPH(glyph
)) + SWAPW(deltaGlyphID
);
51 if (filter
== NULL
|| filter
->accept(LE_SET_GLYPH(glyph
, substitute
))) {
52 glyphIterator
->setCurrGlyphID(substitute
);
61 le_uint32
SingleSubstitutionFormat2Subtable::process(GlyphIterator
*glyphIterator
, const LEGlyphFilter
*filter
) const
63 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
64 le_int32 coverageIndex
= getGlyphCoverage(glyph
);
66 if (coverageIndex
>= 0) {
67 TTGlyphID substitute
= SWAPW(substituteArray
[coverageIndex
]);
69 if (filter
== NULL
|| filter
->accept(LE_SET_GLYPH(glyph
, substitute
))) {
70 glyphIterator
->setCurrGlyphID(substitute
);