blob: 4ba6cf5803c020f1c37f1107954c47a0d711bc20 [file] [log] [blame]
claireho55693312010-04-26 13:43:16 -07001/*
2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2006 Behdad Esfahbod
4 *
5 * This is part of HarfBuzz, an OpenType Layout engine library.
6 *
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
12 *
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17 * DAMAGE.
18 *
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 */
25
26#ifndef HARFBUZZ_OPEN_H
27#define HARFBUZZ_OPEN_H
28
29#include "harfbuzz-global.h"
30
31HB_BEGIN_HEADER
32
claireho57e61072010-11-11 10:57:27 -080033#ifdef HB_USE_PACKED_STRUCTS
34#pragma pack(push, 1)
35#endif
36
claireho55693312010-04-26 13:43:16 -070037/* Use this if a feature applies to all glyphs */
38#define HB_ALL_GLYPHS 0xFFFF
39
40#define HB_DEFAULT_LANGUAGE 0xFFFF
41
42#define HB_MAX_NESTING_LEVEL 100
43
44
45/* Script list related structures */
46
47struct HB_LangSys_
48{
claireho57e61072010-11-11 10:57:27 -080049 HB_UShort* FeatureIndex; /* array of Feature indices */
claireho55693312010-04-26 13:43:16 -070050 HB_UShort LookupOrderOffset; /* always 0 for TT Open 1.0 */
51 HB_UShort ReqFeatureIndex; /* required FeatureIndex */
52 HB_UShort FeatureCount; /* number of Feature indices */
claireho55693312010-04-26 13:43:16 -070053};
54
55typedef struct HB_LangSys_ HB_LangSys;
56
57
58struct HB_LangSysRecord_
59{
claireho55693312010-04-26 13:43:16 -070060 HB_LangSys LangSys; /* LangSys table */
claireho57e61072010-11-11 10:57:27 -080061 HB_UInt LangSysTag; /* LangSysTag identifier */
claireho55693312010-04-26 13:43:16 -070062};
63
64typedef struct HB_LangSysRecord_ HB_LangSysRecord;
65
66
67struct HB_ScriptTable_
68{
claireho57e61072010-11-11 10:57:27 -080069 HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
claireho55693312010-04-26 13:43:16 -070070 HB_LangSys DefaultLangSys; /* DefaultLangSys table */
71 HB_UShort LangSysCount; /* number of LangSysRecords */
claireho55693312010-04-26 13:43:16 -070072};
73
74typedef struct HB_ScriptTable_ HB_ScriptTable;
75
76
77struct HB_ScriptRecord_
78{
79 HB_UInt ScriptTag; /* ScriptTag identifier */
80 HB_ScriptTable Script; /* Script table */
81};
82
83typedef struct HB_ScriptRecord_ HB_ScriptRecord;
84
85
86struct HB_ScriptList_
87{
claireho55693312010-04-26 13:43:16 -070088 HB_ScriptRecord* ScriptRecord; /* array of ScriptRecords */
claireho57e61072010-11-11 10:57:27 -080089 HB_UShort ScriptCount; /* number of ScriptRecords */
claireho55693312010-04-26 13:43:16 -070090};
91
92typedef struct HB_ScriptList_ HB_ScriptList;
93
94
95/* Feature list related structures */
96
97struct HB_Feature_
98{
claireho57e61072010-11-11 10:57:27 -080099 HB_UShort* LookupListIndex; /* array of LookupList indices */
claireho55693312010-04-26 13:43:16 -0700100 HB_UShort FeatureParams; /* always 0 for TT Open 1.0 */
101 HB_UShort LookupListCount; /* number of LookupList indices */
claireho55693312010-04-26 13:43:16 -0700102};
103
104typedef struct HB_Feature_ HB_Feature;
105
106
107struct HB_FeatureRecord_
108{
109 HB_UInt FeatureTag; /* FeatureTag identifier */
110 HB_Feature Feature; /* Feature table */
111};
112
113typedef struct HB_FeatureRecord_ HB_FeatureRecord;
114
115
116struct HB_FeatureList_
117{
claireho55693312010-04-26 13:43:16 -0700118 HB_UShort* ApplyOrder; /* order to apply features */
claireho57e61072010-11-11 10:57:27 -0800119 HB_FeatureRecord* FeatureRecord; /* array of FeatureRecords */
120 HB_UShort FeatureCount; /* number of FeatureRecords */
claireho55693312010-04-26 13:43:16 -0700121 HB_UShort ApplyCount; /* number of elements in ApplyOrder */
122};
123
124typedef struct HB_FeatureList_ HB_FeatureList;
125
126
127/* Lookup list related structures */
128
129typedef struct HB_SubTable_ HB_SubTable;
130
131
132struct HB_Lookup_
133{
claireho57e61072010-11-11 10:57:27 -0800134 HB_SubTable* SubTable; /* array of SubTables */
claireho55693312010-04-26 13:43:16 -0700135 HB_UShort LookupType; /* Lookup type */
136 HB_UShort LookupFlag; /* Lookup qualifiers */
137 HB_UShort SubTableCount; /* number of SubTables */
claireho55693312010-04-26 13:43:16 -0700138};
139
140typedef struct HB_Lookup_ HB_Lookup;
141
142
143/* The `Properties' field is not defined in the OpenType specification but
144 is needed for processing lookups. If properties[n] is > 0, the
145 functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will
146 process Lookup[n] for glyphs which have the specific bit not set in
147 the `properties' field of the input string object. */
148
149struct HB_LookupList_
150{
claireho55693312010-04-26 13:43:16 -0700151 HB_Lookup* Lookup; /* array of Lookup records */
152 HB_UInt* Properties; /* array of flags */
claireho57e61072010-11-11 10:57:27 -0800153 HB_UShort LookupCount; /* number of Lookups */
claireho55693312010-04-26 13:43:16 -0700154};
155
156typedef struct HB_LookupList_ HB_LookupList;
157
158
159/* Possible LookupFlag bit masks. `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the
160 OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in
161 OpenType 1.3 -- if set, the last glyph in a cursive attachment
162 sequence has to be positioned on the baseline -- regardless of the
163 writing direction. */
164
165#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT 0x0001
166#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS 0x0002
167#define HB_LOOKUP_FLAG_IGNORE_LIGATURES 0x0004
168#define HB_LOOKUP_FLAG_IGNORE_MARKS 0x0008
169#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS 0xFF00
170
171
172struct HB_CoverageFormat1_
173{
claireho55693312010-04-26 13:43:16 -0700174 HB_UShort* GlyphArray; /* array of glyph IDs */
claireho57e61072010-11-11 10:57:27 -0800175 HB_UShort GlyphCount; /* number of glyphs in GlyphArray */
claireho55693312010-04-26 13:43:16 -0700176};
177
178typedef struct HB_CoverageFormat1_ HB_CoverageFormat1;
179
180
181struct HB_RangeRecord_
182{
183 HB_UShort Start; /* first glyph ID in the range */
184 HB_UShort End; /* last glyph ID in the range */
185 HB_UShort StartCoverageIndex; /* coverage index of first
186 glyph ID in the range */
187};
188
189typedef struct HB_RangeRecord_ HB_RangeRecord;
190
191
192struct HB_CoverageFormat2_
193{
claireho55693312010-04-26 13:43:16 -0700194 HB_RangeRecord* RangeRecord; /* array of RangeRecords */
claireho57e61072010-11-11 10:57:27 -0800195 HB_UShort RangeCount; /* number of RangeRecords */
claireho55693312010-04-26 13:43:16 -0700196};
197
198typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
199
200
201struct HB_Coverage_
202{
claireho57e61072010-11-11 10:57:27 -0800203 HB_Byte CoverageFormat; /* 1 or 2 */
claireho55693312010-04-26 13:43:16 -0700204
205 union
206 {
207 HB_CoverageFormat1 cf1;
208 HB_CoverageFormat2 cf2;
209 } cf;
210};
211
212typedef struct HB_Coverage_ HB_Coverage;
213
214
215struct HB_ClassDefFormat1_
216{
claireho57e61072010-11-11 10:57:27 -0800217 HB_UShort* ClassValueArray; /* array of class values */
claireho55693312010-04-26 13:43:16 -0700218 HB_UShort StartGlyph; /* first glyph ID of the
219 ClassValueArray */
220 HB_UShort GlyphCount; /* size of the ClassValueArray */
claireho55693312010-04-26 13:43:16 -0700221};
222
223typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1;
224
225
226struct HB_ClassRangeRecord_
227{
228 HB_UShort Start; /* first glyph ID in the range */
229 HB_UShort End; /* last glyph ID in the range */
230 HB_UShort Class; /* applied to all glyphs in range */
231};
232
233typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord;
234
235
236struct HB_ClassDefFormat2_
237{
claireho55693312010-04-26 13:43:16 -0700238 HB_ClassRangeRecord* ClassRangeRecord;
239 /* array of ClassRangeRecords */
claireho57e61072010-11-11 10:57:27 -0800240 HB_UShort ClassRangeCount;
241 /* number of ClassRangeRecords */
claireho55693312010-04-26 13:43:16 -0700242};
243
244typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
245
246
247struct HB_ClassDefinition_
248{
claireho55693312010-04-26 13:43:16 -0700249 union
250 {
251 HB_ClassDefFormat1 cd1;
252 HB_ClassDefFormat2 cd2;
253 } cd;
claireho57e61072010-11-11 10:57:27 -0800254
255 HB_Byte ClassFormat; /* 1 or 2 */
256 HB_Bool loaded;
claireho55693312010-04-26 13:43:16 -0700257};
258
259typedef struct HB_ClassDefinition_ HB_ClassDefinition;
260
261
262struct HB_Device_
263{
claireho57e61072010-11-11 10:57:27 -0800264 HB_UShort* DeltaValue; /* array of compressed data */
claireho55693312010-04-26 13:43:16 -0700265 HB_UShort StartSize; /* smallest size to correct */
266 HB_UShort EndSize; /* largest size to correct */
claireho57e61072010-11-11 10:57:27 -0800267 HB_Byte DeltaFormat; /* DeltaValue array data format:
claireho55693312010-04-26 13:43:16 -0700268 1, 2, or 3 */
claireho55693312010-04-26 13:43:16 -0700269};
270
271typedef struct HB_Device_ HB_Device;
272
273
274enum HB_Type_
275{
276 HB_Type_GSUB,
277 HB_Type_GPOS
278};
279
280typedef enum HB_Type_ HB_Type;
281
claireho57e61072010-11-11 10:57:27 -0800282#ifdef HB_USE_PACKED_STRUCTS
283#pragma pack(pop)
284#endif
claireho55693312010-04-26 13:43:16 -0700285
286HB_END_HEADER
287
288#endif /* HARFBUZZ_OPEN_H */