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-2005 - All Rights Reserved
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
|
|
32 |
#include "LETypes.h"
|
|
33 |
#include "LEGlyphFilter.h"
|
|
34 |
#include "LEFontInstance.h"
|
|
35 |
#include "OpenTypeTables.h"
|
7486
|
36 |
#include "ICUFeatures.h"
|
2
|
37 |
#include "Lookups.h"
|
|
38 |
#include "ScriptAndLanguage.h"
|
|
39 |
#include "GlyphDefinitionTables.h"
|
|
40 |
#include "GlyphSubstitutionTables.h"
|
|
41 |
#include "SingleSubstitutionSubtables.h"
|
|
42 |
#include "MultipleSubstSubtables.h"
|
|
43 |
#include "AlternateSubstSubtables.h"
|
|
44 |
#include "LigatureSubstSubtables.h"
|
|
45 |
#include "ContextualSubstSubtables.h"
|
|
46 |
#include "ExtensionSubtables.h"
|
|
47 |
#include "LookupProcessor.h"
|
|
48 |
#include "GlyphSubstLookupProc.h"
|
|
49 |
#include "LESwaps.h"
|
|
50 |
|
3935
|
51 |
U_NAMESPACE_BEGIN
|
|
52 |
|
2
|
53 |
GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
|
16891
|
54 |
const LEReferenceTo<GlyphSubstitutionTableHeader> &glyphSubstitutionTableHeader,
|
7486
|
55 |
LETag scriptTag,
|
|
56 |
LETag languageTag,
|
|
57 |
const LEGlyphFilter *filter,
|
|
58 |
const FeatureMap *featureMap,
|
|
59 |
le_int32 featureMapCount,
|
|
60 |
le_bool featureOrder,
|
|
61 |
LEErrorCode& success)
|
2
|
62 |
: LookupProcessor(
|
16891
|
63 |
glyphSubstitutionTableHeader,
|
2
|
64 |
SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
|
|
65 |
SWAPW(glyphSubstitutionTableHeader->featureListOffset),
|
|
66 |
SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
|
7486
|
67 |
scriptTag, languageTag, featureMap, featureMapCount, featureOrder, success), fFilter(filter)
|
2
|
68 |
{
|
|
69 |
// anything?
|
|
70 |
}
|
|
71 |
|
|
72 |
GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor()
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
16891
|
76 |
le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType,
|
7486
|
77 |
GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
|
2
|
78 |
{
|
7486
|
79 |
if (LE_FAILURE(success)) {
|
|
80 |
return 0;
|
|
81 |
}
|
|
82 |
|
2
|
83 |
le_uint32 delta = 0;
|
|
84 |
|
|
85 |
switch(lookupType)
|
|
86 |
{
|
|
87 |
case 0:
|
|
88 |
break;
|
|
89 |
|
|
90 |
case gsstSingle:
|
|
91 |
{
|
16891
|
92 |
const LEReferenceTo<SingleSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
93 |
|
16891
|
94 |
delta = subtable->process(subtable, glyphIterator, success, fFilter);
|
2
|
95 |
break;
|
|
96 |
}
|
|
97 |
|
|
98 |
case gsstMultiple:
|
|
99 |
{
|
16891
|
100 |
const LEReferenceTo<MultipleSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
101 |
|
16891
|
102 |
delta = subtable->process(subtable, glyphIterator, success, fFilter);
|
2
|
103 |
break;
|
|
104 |
}
|
|
105 |
|
|
106 |
case gsstAlternate:
|
|
107 |
{
|
16891
|
108 |
const LEReferenceTo<AlternateSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
109 |
|
16891
|
110 |
delta = subtable->process(subtable, glyphIterator, success, fFilter);
|
2
|
111 |
break;
|
|
112 |
}
|
|
113 |
|
|
114 |
case gsstLigature:
|
|
115 |
{
|
16891
|
116 |
const LEReferenceTo<LigatureSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
117 |
|
16891
|
118 |
delta = subtable->process(subtable, glyphIterator, success, fFilter);
|
2
|
119 |
break;
|
|
120 |
}
|
|
121 |
|
|
122 |
case gsstContext:
|
|
123 |
{
|
16891
|
124 |
const LEReferenceTo<ContextualSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
125 |
|
7486
|
126 |
delta = subtable->process(this, glyphIterator, fontInstance, success);
|
2
|
127 |
break;
|
|
128 |
}
|
|
129 |
|
|
130 |
case gsstChainingContext:
|
|
131 |
{
|
16891
|
132 |
const LEReferenceTo<ChainingContextualSubstitutionSubtable> subtable(lookupSubtable, success);
|
2
|
133 |
|
7486
|
134 |
delta = subtable->process(this, glyphIterator, fontInstance, success);
|
2
|
135 |
break;
|
|
136 |
}
|
|
137 |
|
|
138 |
case gsstExtension:
|
|
139 |
{
|
16891
|
140 |
const LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success);
|
2
|
141 |
|
7486
|
142 |
delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
|
2
|
143 |
break;
|
|
144 |
}
|
|
145 |
|
|
146 |
default:
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
|
|
150 |
return delta;
|
|
151 |
}
|
|
152 |
|
|
153 |
GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
|
|
154 |
{
|
|
155 |
}
|
3935
|
156 |
|
|
157 |
U_NAMESPACE_END
|