contrib/OWB: add correct SDL dependency, fix compilers used
[AROS-Contrib.git] / freetype1 / lib / extend / ftxgdef.h
blob33872321f658f9d21cf1a89d23ea7dfc7636680f
1 /*******************************************************************
3 * ftxgdef.h
5 * TrueType Open GDEF table support
7 * Copyright 1996-1999 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 * This file is part of the FreeType project, and may only be used
11 * modified and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
16 ******************************************************************/
18 #ifndef FTXOPEN_H
19 #error "Don't include this file! Use ftxopen.h instead."
20 #endif
22 #ifndef FTXGDEF_H
23 #define FTXGDEF_H
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 #define TTO_Err_Invalid_GDEF_SubTable_Format 0x1030
30 #define TTO_Err_Invalid_GDEF_SubTable 0x1031
33 /* GDEF glyph classes */
35 #define UNCLASSIFIED_GLYPH 0
36 #define SIMPLE_GLYPH 1
37 #define LIGATURE_GLYPH 2
38 #define MARK_GLYPH 3
39 #define COMPONENT_GLYPH 4
41 /* GDEF glyph properties, corresponding to class values 1-4. Note that
42 TTO_COMPONENT has no corresponding flag in the LookupFlag field. */
44 #define TTO_BASE_GLYPH 0x0002
45 #define TTO_LIGATURE 0x0004
46 #define TTO_MARK 0x0008
47 #define TTO_COMPONENT 0x0010
50 /* Attachment related structures */
52 struct TTO_AttachPoint_
54 TT_UShort PointCount; /* size of the PointIndex array */
55 TT_UShort* PointIndex; /* array of contour points */
58 typedef struct TTO_AttachPoint_ TTO_AttachPoint;
61 struct TTO_AttachList_
63 TT_Bool loaded;
65 TTO_Coverage Coverage; /* Coverage table */
66 TT_UShort GlyphCount; /* number of glyphs with
67 attachments */
68 TTO_AttachPoint* AttachPoint; /* array of AttachPoint tables */
71 typedef struct TTO_AttachList_ TTO_AttachList;
74 /* Ligature Caret related structures */
76 struct TTO_CaretValueFormat1_
78 TT_Short Coordinate; /* x or y value (in design units) */
81 typedef struct TTO_CaretValueFormat1_ TTO_CaretValueFormat1;
84 struct TTO_CaretValueFormat2_
86 TT_UShort CaretValuePoint; /* contour point index on glyph */
89 typedef struct TTO_CaretValueFormat2_ TTO_CaretValueFormat2;
92 struct TTO_CaretValueFormat3_
94 TT_Short Coordinate; /* x or y value (in design units) */
95 TTO_Device Device; /* Device table for x or y value */
98 typedef struct TTO_CaretValueFormat3_ TTO_CaretValueFormat3;
101 struct TTO_CaretValueFormat4_
103 TT_UShort IdCaretValue; /* metric ID */
106 typedef struct TTO_CaretValueFormat4_ TTO_CaretValueFormat4;
109 struct TTO_CaretValue_
111 TT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */
113 union
115 TTO_CaretValueFormat1 cvf1;
116 TTO_CaretValueFormat2 cvf2;
117 TTO_CaretValueFormat3 cvf3;
118 TTO_CaretValueFormat4 cvf4;
119 } cvf;
122 typedef struct TTO_CaretValue_ TTO_CaretValue;
125 struct TTO_LigGlyph_
127 TT_Bool loaded;
129 TT_UShort CaretCount; /* number of caret values */
130 TTO_CaretValue* CaretValue; /* array of caret values */
133 typedef struct TTO_LigGlyph_ TTO_LigGlyph;
136 struct TTO_LigCaretList_
138 TT_Bool loaded;
140 TTO_Coverage Coverage; /* Coverage table */
141 TT_UShort LigGlyphCount; /* number of ligature glyphs */
142 TTO_LigGlyph* LigGlyph; /* array of LigGlyph tables */
145 typedef struct TTO_LigCaretList_ TTO_LigCaretList;
148 /* The `NewGlyphClasses' field is not defined in the TTO specification.
149 We use it for fonts with a constructed `GlyphClassDef' structure
150 (i.e., which don't have a GDEF table) to collect glyph classes
151 assigned during the lookup process. The number of arrays in this
152 pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
153 array then contains the glyph class values of the glyphs not covered
154 by the ClassRangeRecords structures with index n-1 and n. We store
155 glyph class values for four glyphs in a single array element.
157 `LastGlyph' is identical to the number of glyphs minus one in the
158 font; we need it only if `NewGlyphClasses' is not NULL (to have an
159 upper bound for the last array).
161 Note that we first store the file offset to the `MarkAttachClassDef'
162 field (which has been introduced in OpenType 1.2) -- since the
163 `Version' field value hasn't been increased to indicate that we have
164 one more field for some obscure reason, we must parse the GSUB table
165 to find out whether class values refer to this table. Only then we
166 can finally load the MarkAttachClassDef structure if necessary. */
168 struct TTO_GDEFHeader_
170 TT_Bool loaded;
171 TT_ULong offset;
173 TT_Fixed Version;
175 TTO_ClassDefinition GlyphClassDef;
176 TTO_AttachList AttachList;
177 TTO_LigCaretList LigCaretList;
178 TT_ULong MarkAttachClassDef_offset;
179 TTO_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
181 TT_UShort LastGlyph;
182 TT_UShort** NewGlyphClasses;
185 typedef struct TTO_GDEFHeader_ TTO_GDEFHeader;
188 /* finally, the GDEF API */
190 EXPORT_DEF
191 TT_Error TT_Init_GDEF_Extension( TT_Engine engine );
193 EXPORT_DEF
194 TT_Error TT_Load_GDEF_Table( TT_Face face,
195 TTO_GDEFHeader* gdef );
197 EXPORT_DEF
198 TT_Error TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef,
199 TT_UShort glyphID,
200 TT_UShort* property );
201 EXPORT_DEF
202 TT_Error TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef,
203 TT_UShort num_glyphs,
204 TT_UShort glyph_count,
205 TT_UShort* glyph_array,
206 TT_UShort* class_array );
209 #ifdef __cplusplus
211 #endif
213 #endif /* FTXGDEF_H */
216 /* END */