3 * (C) Copyright IBM Corp. 1998-2008 - 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
,
51 LEErrorCode
& success
);
54 struct ContextualSubstitutionSubtable
: ContextualSubstitutionBase
56 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
59 struct ContextualSubstitutionFormat1Subtable
: ContextualSubstitutionSubtable
61 le_uint16 subRuleSetCount
;
62 Offset subRuleSetTableOffsetArray
[ANY_NUMBER
];
64 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
67 struct SubRuleSetTable
69 le_uint16 subRuleCount
;
70 Offset subRuleTableOffsetArray
[ANY_NUMBER
];
74 // NOTE: Multiple variable size arrays!!
79 TTGlyphID inputGlyphArray
[ANY_NUMBER
];
80 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
83 struct ContextualSubstitutionFormat2Subtable
: ContextualSubstitutionSubtable
85 Offset classDefTableOffset
;
86 le_uint16 subClassSetCount
;
87 Offset subClassSetTableOffsetArray
[ANY_NUMBER
];
89 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
92 struct SubClassSetTable
94 le_uint16 subClassRuleCount
;
95 Offset subClassRuleTableOffsetArray
[ANY_NUMBER
];
98 // NOTE: Multiple variable size arrays!!
99 struct SubClassRuleTable
101 le_uint16 glyphCount
;
102 le_uint16 substCount
;
103 le_uint16 classArray
[ANY_NUMBER
];
104 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
107 // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
108 // it has an array of coverage tables instead of a single coverage table...
110 // NOTE: Multiple variable size arrays!!
111 struct ContextualSubstitutionFormat3Subtable
113 le_uint16 substFormat
;
114 le_uint16 glyphCount
;
115 le_uint16 substCount
;
116 Offset coverageTableOffsetArray
[ANY_NUMBER
];
117 //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
119 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
122 struct ChainingContextualSubstitutionSubtable
: ContextualSubstitutionBase
124 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
127 struct ChainingContextualSubstitutionFormat1Subtable
: ChainingContextualSubstitutionSubtable
129 le_uint16 chainSubRuleSetCount
;
130 Offset chainSubRuleSetTableOffsetArray
[ANY_NUMBER
];
132 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
135 struct ChainSubRuleSetTable
137 le_uint16 chainSubRuleCount
;
138 Offset chainSubRuleTableOffsetArray
[ANY_NUMBER
];
142 // NOTE: Multiple variable size arrays!!
143 struct ChainSubRuleTable
145 le_uint16 backtrackGlyphCount
;
146 TTGlyphID backtrackGlyphArray
[ANY_NUMBER
];
147 //le_uint16 inputGlyphCount;
148 //TTGlyphID inputGlyphArray[ANY_NUMBER];
149 //le_uint16 lookaheadGlyphCount;
150 //TTGlyphID lookaheadGlyphArray[ANY_NUMBER];
151 //le_uint16 substCount;
152 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
155 struct ChainingContextualSubstitutionFormat2Subtable
: ChainingContextualSubstitutionSubtable
157 Offset backtrackClassDefTableOffset
;
158 Offset inputClassDefTableOffset
;
159 Offset lookaheadClassDefTableOffset
;
160 le_uint16 chainSubClassSetCount
;
161 Offset chainSubClassSetTableOffsetArray
[ANY_NUMBER
];
163 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;
166 struct ChainSubClassSetTable
168 le_uint16 chainSubClassRuleCount
;
169 Offset chainSubClassRuleTableOffsetArray
[ANY_NUMBER
];
172 // NOTE: Multiple variable size arrays!!
173 struct ChainSubClassRuleTable
175 le_uint16 backtrackGlyphCount
;
176 le_uint16 backtrackClassArray
[ANY_NUMBER
];
177 //le_uint16 inputGlyphCount;
178 //le_uint16 inputClassArray[ANY_NUMBER];
179 //le_uint16 lookaheadGlyphCount;
180 //le_uint16 lookaheadClassArray[ANY_NUMBER];
181 //le_uint16 substCount;
182 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
185 // NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
186 // it has arrays of coverage tables instead of a single coverage table...
188 // NOTE: Multiple variable size arrays!!
189 struct ChainingContextualSubstitutionFormat3Subtable
191 le_uint16 substFormat
;
192 le_uint16 backtrackGlyphCount
;
193 Offset backtrackCoverageTableOffsetArray
[ANY_NUMBER
];
194 //le_uint16 inputGlyphCount;
195 //Offset inputCoverageTableOffsetArray[ANY_NUMBER];
196 //le_uint16 lookaheadGlyphCount;
197 //le_uint16 lookaheadCoverageTableOffsetArray[ANY_NUMBER];
198 //le_uint16 substCount;
199 //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
201 le_uint32
process(const LookupProcessor
*lookupProcessor
, GlyphIterator
*glyphIterator
, const LEFontInstance
*fontInstance
, LEErrorCode
& success
) const;