2
|
1 |
/*
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
3 |
*
|
|
4 |
* This code is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
6 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
7 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
8 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
9 |
*
|
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
* accompanied this code).
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License version
|
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
*
|
5506
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
21 |
* or visit www.oracle.com if you need additional information or have any
|
|
22 |
* questions.
|
2
|
23 |
*
|
|
24 |
*/
|
|
25 |
|
|
26 |
/*
|
|
27 |
*
|
|
28 |
* (C) Copyright IBM Corp. 1998 - 2004 - All Rights Reserved
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
|
|
32 |
|
|
33 |
#include "LETypes.h"
|
|
34 |
#include "LayoutTables.h"
|
|
35 |
#include "MorphTables.h"
|
|
36 |
#include "SubtableProcessor.h"
|
|
37 |
#include "IndicRearrangementProcessor.h"
|
|
38 |
#include "ContextualGlyphSubstProc.h"
|
|
39 |
#include "LigatureSubstProc.h"
|
|
40 |
#include "NonContextualGlyphSubstProc.h"
|
|
41 |
//#include "ContextualGlyphInsertionProcessor.h"
|
|
42 |
#include "LEGlyphStorage.h"
|
|
43 |
#include "LESwaps.h"
|
|
44 |
|
3935
|
45 |
U_NAMESPACE_BEGIN
|
|
46 |
|
16891
|
47 |
void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
|
2
|
48 |
{
|
16891
|
49 |
le_uint32 chainCount = SWAPL(this->nChains);
|
|
50 |
LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header
|
|
51 |
LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount);
|
2
|
52 |
le_uint32 chain;
|
|
53 |
|
16891
|
54 |
for (chain = 0; LE_SUCCESS(success) && (chain < chainCount); chain += 1) {
|
2
|
55 |
FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
|
|
56 |
le_uint32 chainLength = SWAPL(chainHeader->chainLength);
|
|
57 |
le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
|
|
58 |
le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
|
16891
|
59 |
LEReferenceTo<MorphSubtableHeader> subtableHeader =
|
|
60 |
LEReferenceTo<MorphSubtableHeader>(chainHeader,success, &(chainHeader->featureTable[nFeatureEntries]));
|
2
|
61 |
le_int16 subtable;
|
|
62 |
|
16891
|
63 |
for (subtable = 0; LE_SUCCESS(success) && (subtable < nSubtables); subtable += 1) {
|
2
|
64 |
le_int16 length = SWAPW(subtableHeader->length);
|
|
65 |
SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
|
|
66 |
FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
|
|
67 |
|
|
68 |
// should check coverage more carefully...
|
16891
|
69 |
if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0 && LE_SUCCESS(success)) {
|
|
70 |
subtableHeader->process(subtableHeader, glyphStorage, success);
|
2
|
71 |
}
|
|
72 |
|
16891
|
73 |
subtableHeader.addOffset(length, success);
|
2
|
74 |
}
|
16891
|
75 |
chainHeader.addOffset(chainLength, success);
|
2
|
76 |
}
|
|
77 |
}
|
|
78 |
|
16891
|
79 |
void MorphSubtableHeader::process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
|
2
|
80 |
{
|
|
81 |
SubtableProcessor *processor = NULL;
|
|
82 |
|
|
83 |
switch (SWAPW(coverage) & scfTypeMask)
|
|
84 |
{
|
|
85 |
case mstIndicRearrangement:
|
16891
|
86 |
processor = new IndicRearrangementProcessor(base, success);
|
2
|
87 |
break;
|
|
88 |
|
|
89 |
case mstContextualGlyphSubstitution:
|
16891
|
90 |
processor = new ContextualGlyphSubstitutionProcessor(base, success);
|
2
|
91 |
break;
|
|
92 |
|
|
93 |
case mstLigatureSubstitution:
|
16891
|
94 |
processor = new LigatureSubstitutionProcessor(base, success);
|
2
|
95 |
break;
|
|
96 |
|
|
97 |
case mstReservedUnused:
|
|
98 |
break;
|
|
99 |
|
|
100 |
case mstNonContextualGlyphSubstitution:
|
16891
|
101 |
processor = NonContextualGlyphSubstitutionProcessor::createInstance(base, success);
|
2
|
102 |
break;
|
|
103 |
|
|
104 |
/*
|
|
105 |
case mstContextualGlyphInsertion:
|
|
106 |
processor = new ContextualGlyphInsertionProcessor(this);
|
|
107 |
break;
|
|
108 |
*/
|
|
109 |
|
|
110 |
default:
|
|
111 |
break;
|
|
112 |
}
|
|
113 |
|
|
114 |
if (processor != NULL) {
|
16891
|
115 |
if(LE_SUCCESS(success)) {
|
|
116 |
processor->process(glyphStorage, success);
|
|
117 |
}
|
|
118 |
delete processor;
|
2
|
119 |
}
|
|
120 |
}
|
3935
|
121 |
|
|
122 |
U_NAMESPACE_END
|