]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/ContextualSubstSubtables.h
ICU-511.27.tar.gz
[apple/icu.git] / icuSources / layout / ContextualSubstSubtables.h
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
729e4ab9 3 * (C) Copyright IBM Corp. 1998-2008 - 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
22U_NAMESPACE_BEGIN
23
24struct SubstitutionLookupRecord
25{
26 le_uint16 sequenceIndex;
27 le_uint16 lookupListIndex;
28};
29
30struct 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,
729e4ab9
A
50 le_int32 position,
51 LEErrorCode& success);
b75a7d8f
A
52};
53
54struct ContextualSubstitutionSubtable : ContextualSubstitutionBase
55{
729e4ab9 56 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
57};
58
59struct ContextualSubstitutionFormat1Subtable : ContextualSubstitutionSubtable
60{
61 le_uint16 subRuleSetCount;
62 Offset subRuleSetTableOffsetArray[ANY_NUMBER];
63
729e4ab9 64 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
65};
66
67struct SubRuleSetTable
68{
69 le_uint16 subRuleCount;
70 Offset subRuleTableOffsetArray[ANY_NUMBER];
71
72};
73
74// NOTE: Multiple variable size arrays!!
75struct SubRuleTable
76{
77 le_uint16 glyphCount;
78 le_uint16 substCount;
79 TTGlyphID inputGlyphArray[ANY_NUMBER];
80 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
81};
82
83struct ContextualSubstitutionFormat2Subtable : ContextualSubstitutionSubtable
84{
85 Offset classDefTableOffset;
86 le_uint16 subClassSetCount;
87 Offset subClassSetTableOffsetArray[ANY_NUMBER];
88
729e4ab9 89 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
90};
91
92struct SubClassSetTable
93{
94 le_uint16 subClassRuleCount;
95 Offset subClassRuleTableOffsetArray[ANY_NUMBER];
96};
97
98// NOTE: Multiple variable size arrays!!
99struct SubClassRuleTable
100{
101 le_uint16 glyphCount;
102 le_uint16 substCount;
103 le_uint16 classArray[ANY_NUMBER];
104 //SubstitutionLookupRecord substLookupRecordArray[ANY_NUMBER];
105};
106
107// NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
108// it has an array of coverage tables instead of a single coverage table...
109//
110// NOTE: Multiple variable size arrays!!
111struct ContextualSubstitutionFormat3Subtable
112{
113 le_uint16 substFormat;
114 le_uint16 glyphCount;
115 le_uint16 substCount;
116 Offset coverageTableOffsetArray[ANY_NUMBER];
117 //SubstitutionLookupRecord substLookupRecord[ANY_NUMBER];
118
729e4ab9 119 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
120};
121
122struct ChainingContextualSubstitutionSubtable : ContextualSubstitutionBase
123{
729e4ab9 124 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
125};
126
127struct ChainingContextualSubstitutionFormat1Subtable : ChainingContextualSubstitutionSubtable
128{
129 le_uint16 chainSubRuleSetCount;
130 Offset chainSubRuleSetTableOffsetArray[ANY_NUMBER];
131
729e4ab9 132 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
133};
134
135struct ChainSubRuleSetTable
136{
137 le_uint16 chainSubRuleCount;
138 Offset chainSubRuleTableOffsetArray[ANY_NUMBER];
139
140};
141
142// NOTE: Multiple variable size arrays!!
143struct ChainSubRuleTable
144{
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];
153};
154
155struct ChainingContextualSubstitutionFormat2Subtable : ChainingContextualSubstitutionSubtable
156{
157 Offset backtrackClassDefTableOffset;
158 Offset inputClassDefTableOffset;
159 Offset lookaheadClassDefTableOffset;
160 le_uint16 chainSubClassSetCount;
161 Offset chainSubClassSetTableOffsetArray[ANY_NUMBER];
162
729e4ab9 163 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
164};
165
166struct ChainSubClassSetTable
167{
168 le_uint16 chainSubClassRuleCount;
169 Offset chainSubClassRuleTableOffsetArray[ANY_NUMBER];
170};
171
172// NOTE: Multiple variable size arrays!!
173struct ChainSubClassRuleTable
174{
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];
183};
184
185// NOTE: This isn't a subclass of GlyphSubstitutionSubtable 'cause
186// it has arrays of coverage tables instead of a single coverage table...
187//
188// NOTE: Multiple variable size arrays!!
189struct ChainingContextualSubstitutionFormat3Subtable
190{
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];
200
729e4ab9 201 le_uint32 process(const LookupProcessor *lookupProcessor, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
b75a7d8f
A
202};
203
204U_NAMESPACE_END
205#endif