4 * (C) Copyright IBM Corp. 1998 - 2013 - 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(const LETableReference
&base
, LEGlyphStorage
&glyphStorage
, LEErrorCode
&success
) const
25 le_uint32 chainCount
= SWAPL(this->nChains
);
26 LEReferenceTo
<ChainHeader
> chainHeader(base
, success
, chains
); // moving header
27 LEReferenceToArrayOf
<ChainHeader
> chainHeaderArray(base
, success
, chains
, chainCount
);
30 for (chain
= 0; LE_SUCCESS(success
) && (chain
< chainCount
); chain
+= 1) {
31 FeatureFlags defaultFlags
= SWAPL(chainHeader
->defaultFlags
);
32 le_uint32 chainLength
= SWAPL(chainHeader
->chainLength
);
33 le_int16 nFeatureEntries
= SWAPW(chainHeader
->nFeatureEntries
);
34 le_int16 nSubtables
= SWAPW(chainHeader
->nSubtables
);
35 LEReferenceTo
<MorphSubtableHeader
> subtableHeader
=
36 LEReferenceTo
<MorphSubtableHeader
>(chainHeader
,success
, &(chainHeader
->featureTable
[nFeatureEntries
]));
39 for (subtable
= 0; LE_SUCCESS(success
) && (subtable
< nSubtables
); subtable
+= 1) {
40 le_int16 length
= SWAPW(subtableHeader
->length
);
41 SubtableCoverage coverage
= SWAPW(subtableHeader
->coverage
);
42 FeatureFlags subtableFeatures
= SWAPL(subtableHeader
->subtableFeatures
);
44 // should check coverage more carefully...
45 if ((coverage
& scfVertical
) == 0 && (subtableFeatures
& defaultFlags
) != 0 && LE_SUCCESS(success
)) {
46 subtableHeader
->process(subtableHeader
, glyphStorage
, success
);
49 subtableHeader
.addOffset(length
, success
);
51 chainHeader
.addOffset(chainLength
, success
);
55 void MorphSubtableHeader::process(const LEReferenceTo
<MorphSubtableHeader
> &base
, LEGlyphStorage
&glyphStorage
, LEErrorCode
&success
) const
57 SubtableProcessor
*processor
= NULL
;
59 switch (SWAPW(coverage
) & scfTypeMask
)
61 case mstIndicRearrangement
:
62 processor
= new IndicRearrangementProcessor(base
, success
);
65 case mstContextualGlyphSubstitution
:
66 processor
= new ContextualGlyphSubstitutionProcessor(base
, success
);
69 case mstLigatureSubstitution
:
70 processor
= new LigatureSubstitutionProcessor(base
, success
);
73 case mstReservedUnused
:
76 case mstNonContextualGlyphSubstitution
:
77 processor
= NonContextualGlyphSubstitutionProcessor::createInstance(base
, success
);
81 case mstContextualGlyphInsertion:
82 processor = new ContextualGlyphInsertionProcessor(this);
90 if (processor
!= NULL
) {
91 if(LE_SUCCESS(success
)) {
92 processor
->process(glyphStorage
, success
);