3 * (C) Copyright IBM Corp. 1998-2013 - 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(const LEReferenceTo
<SingleSubstitutionSubtable
> &base
, GlyphIterator
*glyphIterator
, LEErrorCode
&success
, const LEGlyphFilter
*filter
) const
19 switch(SWAPW(subtableFormat
))
26 const LEReferenceTo
<SingleSubstitutionFormat1Subtable
> subtable(base
, success
, (const SingleSubstitutionFormat1Subtable
*) this);
28 return subtable
->process(subtable
, glyphIterator
, success
, filter
);
33 const LEReferenceTo
<SingleSubstitutionFormat2Subtable
> subtable(base
, success
, (const SingleSubstitutionFormat2Subtable
*) this);
35 return subtable
->process(subtable
, glyphIterator
, success
, filter
);
43 le_uint32
SingleSubstitutionFormat1Subtable::process(const LEReferenceTo
<SingleSubstitutionFormat1Subtable
> &base
, GlyphIterator
*glyphIterator
, LEErrorCode
&success
, const LEGlyphFilter
*filter
) const
45 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
46 le_int32 coverageIndex
= getGlyphCoverage(base
, glyph
, success
);
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(const LEReferenceTo
<SingleSubstitutionFormat2Subtable
> &base
, GlyphIterator
*glyphIterator
, LEErrorCode
&success
, const LEGlyphFilter
*filter
) const
63 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
64 le_int32 coverageIndex
= getGlyphCoverage(base
, glyph
, success
);
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
);