]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | /* |
b75a7d8f | 2 | * |
57a6839d | 3 | * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved |
b75a7d8f A |
4 | * |
5 | */ | |
6 | ||
7 | #ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H | |
8 | #define __CONTEXTUALSUBSTITUTIONSUBTABLES_H | |
9 | ||
10 | /** | |
11 | * \file | |
12 | * \internal | |
13 | */ | |
14 | ||
15 | #include "LETypes.h" | |
16 | #include "LEFontInstance.h" | |
17 | #include "OpenTypeTables.h" | |
18 | #include "GlyphSubstitutionTables.h" | |
19 | #include "GlyphIterator.h" | |
20 | #include "LookupProcessor.h" | |
57a6839d | 21 | #include "LETableReference.h" |
b75a7d8f A |
22 | |
23 | U_NAMESPACE_BEGIN | |
24 | ||
25 | struct SubstitutionLookupRecord | |
26 | { | |
27 | le_uint16 sequenceIndex; | |
28 | le_uint16 lookupListIndex; | |
29 | }; | |
30 | ||
31 | struct ContextualSubstitutionBase : GlyphSubstitutionSubtable | |
32 | { | |
33 | static le_bool matchGlyphIDs( | |
34 | const TTGlyphID *glyphArray, le_uint16 glyphCount, GlyphIterator *glyphIterator, | |
374ca955 | 35 | le_bool backtrack = FALSE); |
b75a7d8f A |
36 | |
37 | static le_bool matchGlyphClasses( | |
38 | const le_uint16 *classArray, le_uint16 glyphCount, GlyphIterator *glyphIterator, | |
374ca955 | 39 | const ClassDefinitionTable *classDefinitionTable, le_bool backtrack = FALSE); |
b75a7d8f A |
40 | |
41 | static le_bool matchGlyphCoverages( | |
42 | const Offset *coverageTableOffsetArray, le_uint16 glyphCount, | |
374ca955 | 43 | GlyphIterator *glyphIterator, const char *offsetBase, le_bool backtrack = FALSE); |
b75a7d8f A |
44 | |
45 | static void applySubstitutionLookups( | |
46 | const LookupProcessor *lookupProcessor, | |
47 | const SubstitutionLookupRecord *substLookupRecordArray, | |
48 | le_uint16 substCount, | |
49 | GlyphIterator *glyphIterator, | |
50 | const LEFontInstance *fontInstance, | |
729e4ab9 A |
51 | le_int32 position, |
52 | LEErrorCode& success); | |
b75a7d8f A |
53 | }; |
54 | ||
55 | struct ContextualSubstitutionSubtable : ContextualSubstitutionBase | |
56 | { | |
729e4ab9 | 57 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f A |
58 | }; |
59 | ||
60 | struct ContextualSubstitutionFormat1Subtable : ContextualSubstitutionSubtable | |
61 | { | |
62 | le_uint16 subRuleSetCount; | |
63 | Offset subRuleSetTableOffsetArray[ANY_NUMBER]; | |
64 | ||
729e4ab9 | 65 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 66 | }; |
57a6839d A |
67 | LE_VAR_ARRAY(ContextualSubstitutionFormat1Subtable, subRuleSetTableOffsetArray) |
68 | ||
b75a7d8f A |
69 | |
70 | struct SubRuleSetTable | |
71 | { | |
72 | le_uint16 subRuleCount; | |
73 | Offset subRuleTableOffsetArray[ANY_NUMBER]; | |
74 | ||
75 | }; | |
57a6839d | 76 | LE_VAR_ARRAY(SubRuleSetTable, subRuleTableOffsetArray) |
b75a7d8f A |
77 | |
78 | // NOTE: Multiple variable size arrays!! | |
79 | struct SubRuleTable | |
80 | { | |
81 | le_uint16 glyphCount; | |
82 | le_uint16 substCount; | |
83 | TTGlyphID inputGlyphArray[ANY_NUMBER]; | |
84 | //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; | |
85 | }; | |
57a6839d | 86 | LE_VAR_ARRAY(SubRuleTable, inputGlyphArray) |
b75a7d8f A |
87 | |
88 | struct ContextualSubstitutionFormat2Subtable : ContextualSubstitutionSubtable | |
89 | { | |
90 | Offset classDefTableOffset; | |
91 | le_uint16 subClassSetCount; | |
92 | Offset subClassSetTableOffsetArray[ANY_NUMBER]; | |
93 | ||
729e4ab9 | 94 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 95 | }; |
57a6839d A |
96 | LE_VAR_ARRAY(ContextualSubstitutionFormat2Subtable, subClassSetTableOffsetArray) |
97 | ||
b75a7d8f A |
98 | |
99 | struct SubClassSetTable | |
100 | { | |
101 | le_uint16 subClassRuleCount; | |
102 | Offset subClassRuleTableOffsetArray[ANY_NUMBER]; | |
103 | }; | |
57a6839d A |
104 | LE_VAR_ARRAY(SubClassSetTable, subClassRuleTableOffsetArray) |
105 | ||
b75a7d8f A |
106 | |
107 | // NOTE: Multiple variable size arrays!! | |
108 | struct SubClassRuleTable | |
109 | { | |
110 | le_uint16 glyphCount; | |
111 | le_uint16 substCount; | |
112 | le_uint16 classArray[ANY_NUMBER]; | |
113 | //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; | |
114 | }; | |
57a6839d A |
115 | LE_VAR_ARRAY(SubClassRuleTable, classArray) |
116 | ||
b75a7d8f A |
117 | |
118 | // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause | |
119 | // it has an array of coverage tables instead of a single coverage table... | |
120 | // | |
121 | // NOTE: Multiple variable size arrays!! | |
122 | struct ContextualSubstitutionFormat3Subtable | |
123 | { | |
124 | le_uint16 substFormat; | |
125 | le_uint16 glyphCount; | |
126 | le_uint16 substCount; | |
127 | Offset coverageTableOffsetArray[ANY_NUMBER]; | |
128 | //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER]; | |
129 | ||
729e4ab9 | 130 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 131 | }; |
57a6839d | 132 | LE_VAR_ARRAY(ContextualSubstitutionFormat3Subtable, coverageTableOffsetArray) |
b75a7d8f A |
133 | |
134 | struct ChainingContextualSubstitutionSubtable : ContextualSubstitutionBase | |
135 | { | |
729e4ab9 | 136 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f A |
137 | }; |
138 | ||
139 | struct ChainingContextualSubstitutionFormat1Subtable : ChainingContextualSubstitutionSubtable | |
140 | { | |
141 | le_uint16 chainSubRuleSetCount; | |
142 | Offset chainSubRuleSetTableOffsetArray[ANY_NUMBER]; | |
143 | ||
729e4ab9 | 144 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 145 | }; |
57a6839d A |
146 | LE_VAR_ARRAY(ChainingContextualSubstitutionFormat1Subtable, chainSubRuleSetTableOffsetArray) |
147 | ||
b75a7d8f A |
148 | |
149 | struct ChainSubRuleSetTable | |
150 | { | |
151 | le_uint16 chainSubRuleCount; | |
152 | Offset chainSubRuleTableOffsetArray[ANY_NUMBER]; | |
153 | ||
154 | }; | |
57a6839d | 155 | LE_VAR_ARRAY(ChainSubRuleSetTable, chainSubRuleTableOffsetArray) |
b75a7d8f A |
156 | |
157 | // NOTE: Multiple variable size arrays!! | |
158 | struct ChainSubRuleTable | |
159 | { | |
160 | le_uint16 backtrackGlyphCount; | |
161 | TTGlyphID backtrackGlyphArray[ANY_NUMBER]; | |
162 | //le_uint16 inputGlyphCount; | |
163 | //TTGlyphID inputGlyphArray[ANY_NUMBER]; | |
164 | //le_uint16 lookaheadGlyphCount; | |
165 | //TTGlyphID lookaheadGlyphArray[ANY_NUMBER]; | |
166 | //le_uint16 substCount; | |
167 | //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; | |
168 | }; | |
57a6839d | 169 | LE_VAR_ARRAY(ChainSubRuleTable, backtrackGlyphArray) |
b75a7d8f A |
170 | |
171 | struct ChainingContextualSubstitutionFormat2Subtable : ChainingContextualSubstitutionSubtable | |
172 | { | |
173 | Offset backtrackClassDefTableOffset; | |
174 | Offset inputClassDefTableOffset; | |
175 | Offset lookaheadClassDefTableOffset; | |
176 | le_uint16 chainSubClassSetCount; | |
177 | Offset chainSubClassSetTableOffsetArray[ANY_NUMBER]; | |
178 | ||
729e4ab9 | 179 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 180 | }; |
57a6839d | 181 | LE_VAR_ARRAY(ChainingContextualSubstitutionFormat2Subtable, chainSubClassSetTableOffsetArray) |
b75a7d8f A |
182 | |
183 | struct ChainSubClassSetTable | |
184 | { | |
185 | le_uint16 chainSubClassRuleCount; | |
186 | Offset chainSubClassRuleTableOffsetArray[ANY_NUMBER]; | |
187 | }; | |
57a6839d A |
188 | LE_VAR_ARRAY(ChainSubClassSetTable, chainSubClassRuleTableOffsetArray) |
189 | ||
b75a7d8f A |
190 | |
191 | // NOTE: Multiple variable size arrays!! | |
192 | struct ChainSubClassRuleTable | |
193 | { | |
194 | le_uint16 backtrackGlyphCount; | |
195 | le_uint16 backtrackClassArray[ANY_NUMBER]; | |
196 | //le_uint16 inputGlyphCount; | |
197 | //le_uint16 inputClassArray[ANY_NUMBER]; | |
198 | //le_uint16 lookaheadGlyphCount; | |
199 | //le_uint16 lookaheadClassArray[ANY_NUMBER]; | |
200 | //le_uint16 substCount; | |
201 | //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER]; | |
202 | }; | |
57a6839d | 203 | LE_VAR_ARRAY(ChainSubClassRuleTable, backtrackClassArray) |
b75a7d8f A |
204 | |
205 | // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause | |
206 | // it has arrays of coverage tables instead of a single coverage table... | |
207 | // | |
208 | // NOTE: Multiple variable size arrays!! | |
209 | struct ChainingContextualSubstitutionFormat3Subtable | |
210 | { | |
211 | le_uint16 substFormat; | |
212 | le_uint16 backtrackGlyphCount; | |
213 | Offset backtrackCoverageTableOffsetArray[ANY_NUMBER]; | |
214 | //le_uint16 inputGlyphCount; | |
215 | //Offset inputCoverageTableOffsetArray[ANY_NUMBER]; | |
216 | //le_uint16 lookaheadGlyphCount; | |
217 | //le_uint16 lookaheadCoverageTableOffsetArray[ANY_NUMBER]; | |
218 | //le_uint16 substCount; | |
219 | //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER]; | |
220 | ||
729e4ab9 | 221 | le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const; |
b75a7d8f | 222 | }; |
57a6839d A |
223 | LE_VAR_ARRAY(ChainingContextualSubstitutionFormat3Subtable, backtrackCoverageTableOffsetArray) |
224 | ||
b75a7d8f A |
225 | |
226 | U_NAMESPACE_END | |
227 | #endif |