summaryrefslogtreecommitdiff
path: root/pango/opentype/ftxopen.h
blob: 052f25cc7030b11462f895169f1273affe17f600 (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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*******************************************************************
 *
 *  ftxopen.h
 *
 *    TrueType Open support.
 *
 *  Copyright 1996-2000 by
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
 *
 *  This file is part of the FreeType project, and may only be used
 *  modified and distributed under the terms of the FreeType project
 *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
 *  this file you indicate that you have read the license and
 *  understand and accept it fully.
 *
 *  This file should be included by the application.  Nevertheless,
 *  the table specific APIs (and structures) are located in files like
 *  ftxgsub.h or ftxgpos.h; these header files are read by ftxopen.h .
 *
 ******************************************************************/

#ifndef FTXOPEN_H
#define FTXOPEN_H

#include <freetype/freetype.h>

#ifdef __cplusplus
extern "C" {
#endif

#define EXPORT_DEF 
#define EXPORT_FUNC

#define TTO_MAX_NESTING_LEVEL  100

#define TTO_Err_Invalid_SubTable_Format   0x1000
#define TTO_Err_Invalid_SubTable          0x1001
#define TTO_Err_Not_Covered               0x1002
#define TTO_Err_Too_Many_Nested_Contexts  0x1003
#define TTO_Err_No_MM_Interpreter         0x1004
#define TTO_Err_Empty_Script              0x1005


  /* Script list related structures */

  struct  TTO_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 TTO_LangSys_  TTO_LangSys;


  struct  TTO_LangSysRecord_
  {
    FT_ULong     LangSysTag;            /* LangSysTag identifier */
    TTO_LangSys  LangSys;               /* LangSys table         */
  };

  typedef struct TTO_LangSysRecord_  TTO_LangSysRecord;


  struct  TTO_Script_
  {
    TTO_LangSys         DefaultLangSys; /* DefaultLangSys table     */
    FT_UShort           LangSysCount;   /* number of LangSysRecords */
    TTO_LangSysRecord*  LangSysRecord;  /* array of LangSysRecords  */
  };

  typedef struct TTO_Script_  TTO_Script;


  struct  TTO_ScriptRecord_
  {
    FT_ULong    ScriptTag;              /* ScriptTag identifier */
    TTO_Script  Script;                 /* Script table         */
  };

  typedef struct TTO_ScriptRecord_  TTO_ScriptRecord;


  struct  TTO_ScriptList_
  {
    FT_UShort          ScriptCount;     /* number of ScriptRecords */
    TTO_ScriptRecord*  ScriptRecord;    /* array of ScriptRecords  */
  };

  typedef struct TTO_ScriptList_  TTO_ScriptList;


  /* Feature list related structures */

  struct TTO_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 TTO_Feature_  TTO_Feature;


  struct  TTO_FeatureRecord_
  {
    FT_ULong     FeatureTag;            /* FeatureTag identifier */
    TTO_Feature  Feature;               /* Feature table         */
  };

  typedef struct TTO_FeatureRecord_  TTO_FeatureRecord;


  struct  TTO_FeatureList_
  {
    FT_UShort           FeatureCount;   /* number of FeatureRecords */
    TTO_FeatureRecord*  FeatureRecord;  /* array of FeatureRecords  */
  };

  typedef struct TTO_FeatureList_  TTO_FeatureList;


  /* Lookup list related structures */

  struct  TTO_SubTable_;                /* defined below after inclusion
                                           of ftxgsub.h and ftxgpos.h    */
  typedef struct TTO_SubTable_  TTO_SubTable;


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

  typedef struct TTO_Lookup_  TTO_Lookup;


  /* The `Properties' field is not defined in the TTO specification but
     is needed for processing lookups.  If properties[n] is > 0, the
     functions TT_GSUB_Apply_String() resp. TT_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  TTO_LookupList_
  {
    FT_UShort    LookupCount;           /* number of Lookups       */
    TTO_Lookup*  Lookup;                /* array of Lookup records */
    FT_UShort*   Properties;            /* array of flags          */
  };

  typedef struct TTO_LookupList_  TTO_LookupList;


/* Possible LookupFlag bit masks.  `IGNORE_SPECIAL_MARKS' comes from the
   OpenType 1.2 specification.                                           */

#define IGNORE_BASE_GLYPHS    0x0002
#define IGNORE_LIGATURES      0x0004
#define IGNORE_MARKS          0x0008
#define IGNORE_SPECIAL_MARKS  0xFF00


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

  typedef struct TTO_CoverageFormat1_  TTO_CoverageFormat1;


  struct TTO_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 TTO_RangeRecord_  TTO_RangeRecord;


  struct  TTO_CoverageFormat2_
  {
    FT_UShort         RangeCount;       /* number of RangeRecords */
    TTO_RangeRecord*  RangeRecord;      /* array of RangeRecords  */
  };

  typedef struct TTO_CoverageFormat2_  TTO_CoverageFormat2;


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

    union
    {
      TTO_CoverageFormat1  cf1;
      TTO_CoverageFormat2  cf2;
    } cf;
  };

  typedef struct TTO_Coverage_  TTO_Coverage;


  struct  TTO_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 TTO_ClassDefFormat1_  TTO_ClassDefFormat1;


  struct  TTO_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 TTO_ClassRangeRecord_  TTO_ClassRangeRecord;


  struct  TTO_ClassDefFormat2_
  {
    FT_UShort              ClassRangeCount;
                                        /* number of ClassRangeRecords */
    TTO_ClassRangeRecord*  ClassRangeRecord;
                                        /* array of ClassRangeRecords  */
  };

  typedef struct TTO_ClassDefFormat2_  TTO_ClassDefFormat2;


  /* The `Defined' field is not defined in the TTO 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  TTO_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
    {
      TTO_ClassDefFormat1  cd1;
      TTO_ClassDefFormat2  cd2;
    } cd;
  };

  typedef struct TTO_ClassDefinition_  TTO_ClassDefinition;


  struct TTO_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 TTO_Device_  TTO_Device;


#include "ftxgdef.h"
#include "ftxgsub.h"
#include "ftxgpos.h"


  struct  TTO_SubTable_
  {
    union
    {
      TTO_GSUB_SubTable  gsub;
      TTO_GPOS_SubTable  gpos;
    } st;
  };


  enum  TTO_Type_
  {
    GSUB,
    GPOS
  };

  typedef enum TTO_Type_  TTO_Type;


#ifdef __cplusplus
}
#endif

#endif /* FTXOPEN_H */


/* END */