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