]>
git.saurik.com Git - apple/icu.git/blob - icuSources/layout/LigatureSubstSubtables.cpp
4 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
9 #include "LEGlyphFilter.h"
10 #include "OpenTypeTables.h"
11 #include "GlyphSubstitutionTables.h"
12 #include "LigatureSubstSubtables.h"
13 #include "GlyphIterator.h"
18 le_uint32
LigatureSubstitutionSubtable::process(GlyphIterator
*glyphIterator
, const LEGlyphFilter
*filter
) const
20 LEGlyphID glyph
= glyphIterator
->getCurrGlyphID();
21 le_int32 coverageIndex
= getGlyphCoverage(glyph
);
23 if (coverageIndex
>= 0) {
24 Offset ligSetTableOffset
= SWAPW(ligSetTableOffsetArray
[coverageIndex
]);
25 const LigatureSetTable
*ligSetTable
= (const LigatureSetTable
*) ((char *) this + ligSetTableOffset
);
26 le_uint16 ligCount
= SWAPW(ligSetTable
->ligatureCount
);
28 for (le_uint16 lig
= 0; lig
< ligCount
; lig
+= 1) {
29 Offset ligTableOffset
= SWAPW(ligSetTable
->ligatureTableOffsetArray
[lig
]);
30 const LigatureTable
*ligTable
= (const LigatureTable
*) ((char *)ligSetTable
+ ligTableOffset
);
31 le_uint16 compCount
= SWAPW(ligTable
->compCount
) - 1;
32 le_int32 startPosition
= glyphIterator
->getCurrStreamPosition();
33 TTGlyphID ligGlyph
= SWAPW(ligTable
->ligGlyph
);
36 if (filter
!= NULL
&& ! filter
->accept(LE_SET_GLYPH(glyph
, ligGlyph
))) {
40 for (comp
= 0; comp
< compCount
; comp
+= 1) {
41 if (! glyphIterator
->next()) {
45 if (LE_GET_GLYPH(glyphIterator
->getCurrGlyphID()) != SWAPW(ligTable
->componentArray
[comp
])) {
50 if (comp
== compCount
) {
51 GlyphIterator
tempIterator(*glyphIterator
);
52 TTGlyphID deletedGlyph
= tempIterator
.ignoresMarks()? 0xFFFE : 0xFFFF;
55 tempIterator
.setCurrGlyphID(deletedGlyph
);
61 tempIterator
.setCurrGlyphID(ligGlyph
);
66 glyphIterator
->setCurrStreamPosition(startPosition
);