summaryrefslogtreecommitdiff
path: root/trunk/pango/opentype/harfbuzz-open.h
blob: 17e1f29b0e9e8500469ed0d771e2c85665a017d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/*******************************************************************
 *
 *  Copyright 1996-2000 by
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
 *
 *  Copyright 2006  Behdad Esfahbod
 *
 *  This is part of HarfBuzz, an OpenType Layout engine library.
 *
 *  See the file name COPYING for licensing information.
 *
 ******************************************************************/
#ifndef HARFBUZZ_OPEN_H
#define HARFBUZZ_OPEN_H

#include <ft2build.h>
#include FT_FREETYPE_H

FT_BEGIN_HEADER

/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS                    0xFFFF

#define HB_DEFAULT_LANGUAGE              0xFFFF

#define HB_MAX_NESTING_LEVEL             100

#define HB_Err_Invalid_SubTable_Format   0x1000
#define HB_Err_Invalid_SubTable          0x1001
#define HB_Err_Not_Covered               0x1002
#define HB_Err_Too_Many_Nested_Contexts  0x1003
#define HB_Err_No_MM_Interpreter         0x1004
#define HB_Err_Empty_Script              0x1005


/* Script list related structures */

struct  HB_LangSys_
{
  FT_UShort   LookupOrderOffset;      /* always 0 for TT Open 1.0  */
  FT_UShort   ReqFeatureIndex;        /* required FeatureIndex     */
  FT_UShort   FeatureCount;           /* number of Feature indices */
  FT_UShort*  FeatureIndex;           /* array of Feature indices  */
};

typedef struct HB_LangSys_  HB_LangSys;


struct  HB_LangSysRecord_
{
  FT_ULong     LangSysTag;            /* LangSysTag identifier */
  HB_LangSys  LangSys;               /* LangSys table         */
};

typedef struct HB_LangSysRecord_  HB_LangSysRecord;


struct  HB_Script_
{
  HB_LangSys         DefaultLangSys; /* DefaultLangSys table     */
  FT_UShort           LangSysCount;   /* number of LangSysRecords */
  HB_LangSysRecord*  LangSysRecord;  /* array of LangSysRecords  */
};

typedef struct HB_Script_  HB_Script;


struct  HB_ScriptRecord_
{
  FT_ULong    ScriptTag;              /* ScriptTag identifier */
  HB_Script  Script;                 /* Script table         */
};

typedef struct HB_ScriptRecord_  HB_ScriptRecord;


struct  HB_ScriptList_
{
  FT_UShort          ScriptCount;     /* number of ScriptRecords */
  HB_ScriptRecord*  ScriptRecord;    /* array of ScriptRecords  */
};

typedef struct HB_ScriptList_  HB_ScriptList;


/* Feature list related structures */

struct HB_Feature_
{
  FT_UShort   FeatureParams;          /* always 0 for TT Open 1.0     */
  FT_UShort   LookupListCount;        /* number of LookupList indices */
  FT_UShort*  LookupListIndex;        /* array of LookupList indices  */
};

typedef struct HB_Feature_  HB_Feature;


struct  HB_FeatureRecord_
{
  FT_ULong     FeatureTag;            /* FeatureTag identifier */
  HB_Feature  Feature;               /* Feature table         */
};

typedef struct HB_FeatureRecord_  HB_FeatureRecord;


struct  HB_FeatureList_
{
  FT_UShort           FeatureCount;   /* number of FeatureRecords */
  HB_FeatureRecord*  FeatureRecord;  /* array of FeatureRecords  */
  FT_UShort*		ApplyOrder;	/* order to apply features */
  FT_UShort		ApplyCount;	/* number of elements in ApplyOrder */
};

typedef struct HB_FeatureList_  HB_FeatureList;


/* Lookup list related structures */

typedef struct HB_SubTable_  HB_SubTable;


struct  HB_Lookup_
{
  FT_UShort      LookupType;          /* Lookup type         */
  FT_UShort      LookupFlag;          /* Lookup qualifiers   */
  FT_UShort      SubTableCount;       /* number of SubTables */
  HB_SubTable*  SubTable;            /* array of SubTables  */
};

typedef struct HB_Lookup_  HB_Lookup;


/* The `Properties' field is not defined in the OpenType specification but
   is needed for processing lookups.  If properties[n] is > 0, the
   functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will
   process Lookup[n] for glyphs which have the specific bit not set in
   the `properties' field of the input string object.                  */

struct  HB_LookupList_
{
  FT_UShort    LookupCount;           /* number of Lookups       */
  HB_Lookup*  Lookup;                /* array of Lookup records */
  FT_UInt*     Properties;            /* array of flags          */
};

typedef struct HB_LookupList_  HB_LookupList;


/* Possible LookupFlag bit masks.  `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the
   OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in
   OpenType 1.3 -- if set, the last glyph in a cursive attachment
   sequence has to be positioned on the baseline -- regardless of the
   writing direction.                                                    */

#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT         0x0001
#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS    0x0002
#define HB_LOOKUP_FLAG_IGNORE_LIGATURES      0x0004
#define HB_LOOKUP_FLAG_IGNORE_MARKS          0x0008
#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS  0xFF00


struct  HB_CoverageFormat1_
{
  FT_UShort   GlyphCount;             /* number of glyphs in GlyphArray */
  FT_UShort*  GlyphArray;             /* array of glyph IDs             */
};

typedef struct HB_CoverageFormat1_  HB_CoverageFormat1;


struct HB_RangeRecord_
{
  FT_UShort  Start;                   /* first glyph ID in the range */
  FT_UShort  End;                     /* last glyph ID in the range  */
  FT_UShort  StartCoverageIndex;      /* coverage index of first
					 glyph ID in the range       */
};

typedef struct HB_RangeRecord_  HB_RangeRecord;


struct  HB_CoverageFormat2_
{
  FT_UShort         RangeCount;       /* number of RangeRecords */
  HB_RangeRecord*  RangeRecord;      /* array of RangeRecords  */
};

typedef struct HB_CoverageFormat2_  HB_CoverageFormat2;


struct  HB_Coverage_
{
  FT_UShort  CoverageFormat;          /* 1 or 2 */

  union
  {
    HB_CoverageFormat1  cf1;
    HB_CoverageFormat2  cf2;
  } cf;
};

typedef struct HB_Coverage_  HB_Coverage;


struct  HB_ClassDefFormat1_
{
  FT_UShort   StartGlyph;             /* first glyph ID of the
					 ClassValueArray             */
  FT_UShort   GlyphCount;             /* size of the ClassValueArray */
  FT_UShort*  ClassValueArray;        /* array of class values       */
};

typedef struct HB_ClassDefFormat1_  HB_ClassDefFormat1;


struct  HB_ClassRangeRecord_
{
  FT_UShort  Start;                   /* first glyph ID in the range    */
  FT_UShort  End;                     /* last glyph ID in the range     */
  FT_UShort  Class;                   /* applied to all glyphs in range */
};

typedef struct HB_ClassRangeRecord_  HB_ClassRangeRecord;


struct  HB_ClassDefFormat2_
{
  FT_UShort              ClassRangeCount;
				      /* number of ClassRangeRecords */
  HB_ClassRangeRecord*  ClassRangeRecord;
				      /* array of ClassRangeRecords  */
};

typedef struct HB_ClassDefFormat2_  HB_ClassDefFormat2;


/* The `Defined' field is not defined in the OpenType specification but
   apparently needed for processing fonts like trado.ttf: This font
   refers to a class which contains not a single element.  We map such
   classes to class 0.                                                 */

struct  HB_ClassDefinition_
{
  FT_Bool    loaded;

  FT_Bool*   Defined;                 /* array of Booleans.
					 If Defined[n] is FALSE,
					 class n contains no glyphs. */
  FT_UShort  ClassFormat;             /* 1 or 2                      */

  union
  {
    HB_ClassDefFormat1  cd1;
    HB_ClassDefFormat2  cd2;
  } cd;
};

typedef struct HB_ClassDefinition_  HB_ClassDefinition;


struct HB_Device_
{
  FT_UShort   StartSize;              /* smallest size to correct      */
  FT_UShort   EndSize;                /* largest size to correct       */
  FT_UShort   DeltaFormat;            /* DeltaValue array data format:
					 1, 2, or 3                    */
  FT_UShort*  DeltaValue;             /* array of compressed data      */
};

typedef struct HB_Device_  HB_Device;


enum  HB_Type_
{
  HB_Type_GSUB,
  HB_Type_GPOS
};

typedef enum HB_Type_  HB_Type;


FT_END_HEADER

#endif /* HARFBUZZ_OPEN_H */