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