3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
7 #ifndef __CONTEXTUALSUBSTITUTIONSUBTABLES_H
8 #define __CONTEXTUALSUBSTITUTIONSUBTABLES_H
16 #include "LEFontInstance.h"
17 #include "OpenTypeTables.h"
18 #include "GlyphSubstitutionTables.h"
19 #include "GlyphIterator.h"
20 #include "LookupProcessor.h"
24 struct SubstitutionLookupRecord
26 le_uint16 sequenceIndex
;
27 le_uint16 lookupListIndex
;
30 struct ContextualSubstitutionBase
: GlyphSubstitutionSubtable
32 static le_bool
matchGlyphIDs(
33 const TTGlyphID
*glyphArray
, le_uint16 glyphCount
, GlyphIterator
*glyphIterator
,
34 le_bool backtrack
= FALSE
);
36 static le_bool
matchGlyphClasses(
37 const le_uint16
*classArray
, le_uint16 glyphCount
, GlyphIterator
*glyphIterator
,
38 const ClassDefinitionTable
*classDefinitionTable
, le_bool backtrack
= FALSE
);
40 static le_bool
matchGlyphCoverages(
41 const Offset
*coverageTableOffsetArray
, le_uint16 glyphCount
,
42 GlyphIterator
*glyphIterator
, const char *offsetBase
, le_bool backtrack
= FALSE
);
44 static void applySubstitutionLookups(
45 const LookupProcessor
*lookupProcessor
,
46 const SubstitutionLookupRecord
*substLookupRecordArray
,
48 GlyphIterator
*glyphIterator
,
49 const LEFontInstance
*fontInstance
,
53 struct ContextualSubstitutionSubtable
: ContextualSubstitutionBase
55 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
58 struct ContextualSubstitutionFormat1Subtable
: ContextualSubstitutionSubtable
60 le_uint16 subRuleSetCount
;
61 Offset subRuleSetTableOffsetArray
[ANY_NUMBER
];
63 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
66 struct SubRuleSetTable
68 le_uint16 subRuleCount
;
69 Offset subRuleTableOffsetArray
[ANY_NUMBER
];
73 // NOTE: Multiple variable size arrays!!
78 TTGlyphID inputGlyphArray
[ANY_NUMBER
];
79 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
82 struct ContextualSubstitutionFormat2Subtable
: ContextualSubstitutionSubtable
84 Offset classDefTableOffset
;
85 le_uint16 subClassSetCount
;
86 Offset subClassSetTableOffsetArray
[ANY_NUMBER
];
88 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
91 struct SubClassSetTable
93 le_uint16 subClassRuleCount
;
94 Offset subClassRuleTableOffsetArray
[ANY_NUMBER
];
97 // NOTE: Multiple variable size arrays!!
98 struct SubClassRuleTable
100 le_uint16 glyphCount
;
101 le_uint16 substCount
;
102 le_uint16 classArray
[ANY_NUMBER
];
103 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
106 // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
107 // it has an array of coverage tables instead of a single coverage table...
109 // NOTE: Multiple variable size arrays!!
110 struct ContextualSubstitutionFormat3Subtable
112 le_uint16 substFormat
;
113 le_uint16 glyphCount
;
114 le_uint16 substCount
;
115 Offset coverageTableOffsetArray
[ANY_NUMBER
];
116 //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
118 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
121 struct ChainingContextualSubstitutionSubtable
: ContextualSubstitutionBase
123 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
126 struct ChainingContextualSubstitutionFormat1Subtable
: ChainingContextualSubstitutionSubtable
128 le_uint16 chainSubRuleSetCount
;
129 Offset chainSubRuleSetTableOffsetArray
[ANY_NUMBER
];
131 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
134 struct ChainSubRuleSetTable
136 le_uint16 chainSubRuleCount
;
137 Offset chainSubRuleTableOffsetArray
[ANY_NUMBER
];
141 // NOTE: Multiple variable size arrays!!
142 struct ChainSubRuleTable
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];
154 struct ChainingContextualSubstitutionFormat2Subtable
: ChainingContextualSubstitutionSubtable
156 Offset backtrackClassDefTableOffset
;
157 Offset inputClassDefTableOffset
;
158 Offset lookaheadClassDefTableOffset
;
159 le_uint16 chainSubClassSetCount
;
160 Offset chainSubClassSetTableOffsetArray
[ANY_NUMBER
];
162 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;
165 struct ChainSubClassSetTable
167 le_uint16 chainSubClassRuleCount
;
168 Offset chainSubClassRuleTableOffsetArray
[ANY_NUMBER
];
171 // NOTE: Multiple variable size arrays!!
172 struct ChainSubClassRuleTable
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];
184 // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
185 // it has arrays of coverage tables instead of a single coverage table...
187 // NOTE: Multiple variable size arrays!!
188 struct ChainingContextualSubstitutionFormat3Subtable
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];
200 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
) const;