]>
git.saurik.com Git - apple/icu.git/blob - icuSources/layout/LigatureSubstSubtables.cpp
2 * (C) Copyright IBM Corp. 1998-2006 - All Rights Reserved
7 #include "LEGlyphFilter.h"
8 #include "OpenTypeTables.h"
9 #include "GlyphSubstitutionTables.h"
10 #include "LigatureSubstSubtables.h"
11 #include "GlyphIterator.h"
16 le_uint32
LigatureSubstitutionSubtable::process(GlyphIterator
*glyphIterator
, const LEGlyphFilter
*filter
) const
18 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
19 le_int32 coverageIndex
= getGlyphCoverage(glyph
);
21 if (coverageIndex
>= 0) {
22 Offset ligSetTableOffset
= SWAPW(ligSetTableOffsetArray
[coverageIndex
]);
23 const LigatureSetTable
*ligSetTable
= (const LigatureSetTable
*) ((char *) this + ligSetTableOffset
);
24 le_uint16 ligCount
= SWAPW(ligSetTable
->ligatureCount
);
26 for (le_uint16 lig
= 0; lig
< ligCount
; lig
+= 1) {
27 Offset ligTableOffset
= SWAPW(ligSetTable
->ligatureTableOffsetArray
[lig
]);
28 const LigatureTable
*ligTable
= (const LigatureTable
*) ((char *)ligSetTable
+ ligTableOffset
);
29 le_uint16 compCount
= SWAPW(ligTable
->compCount
) - 1;
30 le_int32 startPosition
= glyphIterator
->getCurrStreamPosition();
31 TTGlyphID ligGlyph
= SWAPW(ligTable
->ligGlyph
);
34 for (comp
= 0; comp
< compCount
; comp
+= 1) {
35 if (! glyphIterator
->next()) {
39 if (LE_GET_GLYPH(glyphIterator
->getCurrGlyphID()) != SWAPW(ligTable
->componentArray
[comp
])) {
44 if (comp
== compCount
&& (filter
== NULL
|| filter
->accept(LE_SET_GLYPH(glyph
, ligGlyph
)))) {
45 GlyphIterator
tempIterator(*glyphIterator
);
46 TTGlyphID deletedGlyph
= tempIterator
.ignoresMarks()? 0xFFFE : 0xFFFF;
49 tempIterator
.setCurrGlyphID(deletedGlyph
);
55 tempIterator
.setCurrGlyphID(ligGlyph
);
60 glyphIterator
->setCurrStreamPosition(startPosition
);