4 * (C) Copyright IBM Corp. 1998 - 2004 - All Rights Reserved
10 #include "LayoutTables.h"
11 #include "MorphTables.h"
12 #include "SubtableProcessor.h"
13 #include "IndicRearrangementProcessor.h"
14 #include "ContextualGlyphSubstProc.h"
15 #include "LigatureSubstProc.h"
16 #include "NonContextualGlyphSubstProc.h"
17 //#include "ContextualGlyphInsertionProcessor.h"
18 #include "LEGlyphStorage.h"
23 void MorphTableHeader::process(LEGlyphStorage
&glyphStorage
) const
25 const ChainHeader
*chainHeader
= chains
;
26 le_uint32 chainCount
= SWAPL(this->nChains
);
29 for (chain
= 0; chain
< chainCount
; chain
+= 1) {
30 FeatureFlags defaultFlags
= SWAPL(chainHeader
->defaultFlags
);
31 le_uint32 chainLength
= SWAPL(chainHeader
->chainLength
);
32 le_int16 nFeatureEntries
= SWAPW(chainHeader
->nFeatureEntries
);
33 le_int16 nSubtables
= SWAPW(chainHeader
->nSubtables
);
34 const MorphSubtableHeader
*subtableHeader
=
35 (const MorphSubtableHeader
*)&chainHeader
->featureTable
[nFeatureEntries
];
38 for (subtable
= 0; subtable
< nSubtables
; subtable
+= 1) {
39 le_int16 length
= SWAPW(subtableHeader
->length
);
40 SubtableCoverage coverage
= SWAPW(subtableHeader
->coverage
);
41 FeatureFlags subtableFeatures
= SWAPL(subtableHeader
->subtableFeatures
);
43 // should check coverage more carefully...
44 if ((coverage
& scfVertical
) == 0 && (subtableFeatures
& defaultFlags
) != 0) {
45 subtableHeader
->process(glyphStorage
);
48 subtableHeader
= (const MorphSubtableHeader
*) ((char *)subtableHeader
+ length
);
51 chainHeader
= (const ChainHeader
*)((char *)chainHeader
+ chainLength
);
55 void MorphSubtableHeader::process(LEGlyphStorage
&glyphStorage
) const
57 SubtableProcessor
*processor
= NULL
;
59 switch (SWAPW(coverage
) & scfTypeMask
)
61 case mstIndicRearrangement
:
62 processor
= new IndicRearrangementProcessor(this);
65 case mstContextualGlyphSubstitution
:
66 processor
= new ContextualGlyphSubstitutionProcessor(this);
69 case mstLigatureSubstitution
:
70 processor
= new LigatureSubstitutionProcessor(this);
73 case mstReservedUnused
:
76 case mstNonContextualGlyphSubstitution
:
77 processor
= NonContextualGlyphSubstitutionProcessor::createInstance(this);
81 case mstContextualGlyphInsertion:
82 processor = new ContextualGlyphInsertionProcessor(this);
90 if (processor
!= NULL
) {
91 processor
->process(glyphStorage
);