1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* tttables.h */ |
3 * tttables.h |
4 /* */ |
4 * |
5 /* Basic SFNT/TrueType tables definitions and interface */ |
5 * Basic SFNT/TrueType tables definitions and interface |
6 /* (specification only). */ |
6 * (specification only). |
7 /* */ |
7 * |
8 /* Copyright 1996-2018 by */ |
8 * Copyright (C) 1996-2019 by |
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 * David Turner, Robert Wilhelm, and Werner Lemberg. |
10 /* */ |
10 * |
11 /* This file is part of the FreeType project, and may only be used, */ |
11 * This file is part of the FreeType project, and may only be used, |
12 /* modified, and distributed under the terms of the FreeType project */ |
12 * modified, and distributed under the terms of the FreeType project |
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
14 /* this file you indicate that you have read the license and */ |
14 * this file you indicate that you have read the license and |
15 /* understand and accept it fully. */ |
15 * understand and accept it fully. |
16 /* */ |
16 * |
17 /***************************************************************************/ |
17 */ |
18 |
18 |
19 |
19 |
20 #ifndef TTTABLES_H_ |
20 #ifndef TTTABLES_H_ |
21 #define TTTABLES_H_ |
21 #define TTTABLES_H_ |
22 |
22 |
31 #endif |
31 #endif |
32 |
32 |
33 |
33 |
34 FT_BEGIN_HEADER |
34 FT_BEGIN_HEADER |
35 |
35 |
36 /*************************************************************************/ |
36 /************************************************************************** |
37 /* */ |
37 * |
38 /* <Section> */ |
38 * @section: |
39 /* truetype_tables */ |
39 * truetype_tables |
40 /* */ |
40 * |
41 /* <Title> */ |
41 * @title: |
42 /* TrueType Tables */ |
42 * TrueType Tables |
43 /* */ |
43 * |
44 /* <Abstract> */ |
44 * @abstract: |
45 /* TrueType specific table types and functions. */ |
45 * TrueType-specific table types and functions. |
46 /* */ |
46 * |
47 /* <Description> */ |
47 * @description: |
48 /* This section contains definitions of some basic tables specific to */ |
48 * This section contains definitions of some basic tables specific to |
49 /* TrueType and OpenType as well as some routines used to access and */ |
49 * TrueType and OpenType as well as some routines used to access and |
50 /* process them. */ |
50 * process them. |
51 /* */ |
51 * |
52 /* <Order> */ |
52 * @order: |
53 /* TT_Header */ |
53 * TT_Header |
54 /* TT_HoriHeader */ |
54 * TT_HoriHeader |
55 /* TT_VertHeader */ |
55 * TT_VertHeader |
56 /* TT_OS2 */ |
56 * TT_OS2 |
57 /* TT_Postscript */ |
57 * TT_Postscript |
58 /* TT_PCLT */ |
58 * TT_PCLT |
59 /* TT_MaxProfile */ |
59 * TT_MaxProfile |
60 /* */ |
60 * |
61 /* FT_Sfnt_Tag */ |
61 * FT_Sfnt_Tag |
62 /* FT_Get_Sfnt_Table */ |
62 * FT_Get_Sfnt_Table |
63 /* FT_Load_Sfnt_Table */ |
63 * FT_Load_Sfnt_Table |
64 /* FT_Sfnt_Table_Info */ |
64 * FT_Sfnt_Table_Info |
65 /* */ |
65 * |
66 /* FT_Get_CMap_Language_ID */ |
66 * FT_Get_CMap_Language_ID |
67 /* FT_Get_CMap_Format */ |
67 * FT_Get_CMap_Format |
68 /* */ |
68 * |
69 /* FT_PARAM_TAG_UNPATENTED_HINTING */ |
69 * FT_PARAM_TAG_UNPATENTED_HINTING |
70 /* */ |
70 * |
71 /*************************************************************************/ |
71 */ |
72 |
72 |
73 |
73 |
74 /*************************************************************************/ |
74 /************************************************************************** |
75 /* */ |
75 * |
76 /* <Struct> */ |
76 * @struct: |
77 /* TT_Header */ |
77 * TT_Header |
78 /* */ |
78 * |
79 /* <Description> */ |
79 * @description: |
80 /* A structure to model a TrueType font header table. All fields */ |
80 * A structure to model a TrueType font header table. All fields follow |
81 /* follow the OpenType specification. */ |
81 * the OpenType specification. The 64-bit timestamps are stored in |
82 /* */ |
82 * two-element arrays `Created` and `Modified`, first the upper then |
|
83 * the lower 32~bits. |
|
84 */ |
83 typedef struct TT_Header_ |
85 typedef struct TT_Header_ |
84 { |
86 { |
85 FT_Fixed Table_Version; |
87 FT_Fixed Table_Version; |
86 FT_Fixed Font_Revision; |
88 FT_Fixed Font_Revision; |
87 |
89 |
107 FT_Short Glyph_Data_Format; |
109 FT_Short Glyph_Data_Format; |
108 |
110 |
109 } TT_Header; |
111 } TT_Header; |
110 |
112 |
111 |
113 |
112 /*************************************************************************/ |
114 /************************************************************************** |
113 /* */ |
115 * |
114 /* <Struct> */ |
116 * @struct: |
115 /* TT_HoriHeader */ |
117 * TT_HoriHeader |
116 /* */ |
118 * |
117 /* <Description> */ |
119 * @description: |
118 /* A structure to model a TrueType horizontal header, the `hhea' */ |
120 * A structure to model a TrueType horizontal header, the 'hhea' table, |
119 /* table, as well as the corresponding horizontal metrics table, */ |
121 * as well as the corresponding horizontal metrics table, 'hmtx'. |
120 /* `hmtx'. */ |
122 * |
121 /* */ |
123 * @fields: |
122 /* <Fields> */ |
124 * Version :: |
123 /* Version :: The table version. */ |
125 * The table version. |
124 /* */ |
126 * |
125 /* Ascender :: The font's ascender, i.e., the distance */ |
127 * Ascender :: |
126 /* from the baseline to the top-most of all */ |
128 * The font's ascender, i.e., the distance from the baseline to the |
127 /* glyph points found in the font. */ |
129 * top-most of all glyph points found in the font. |
128 /* */ |
130 * |
129 /* This value is invalid in many fonts, as */ |
131 * This value is invalid in many fonts, as it is usually set by the |
130 /* it is usually set by the font designer, */ |
132 * font designer, and often reflects only a portion of the glyphs found |
131 /* and often reflects only a portion of the */ |
133 * in the font (maybe ASCII). |
132 /* glyphs found in the font (maybe ASCII). */ |
134 * |
133 /* */ |
135 * You should use the `sTypoAscender` field of the 'OS/2' table instead |
134 /* You should use the `sTypoAscender' field */ |
136 * if you want the correct one. |
135 /* of the `OS/2' table instead if you want */ |
137 * |
136 /* the correct one. */ |
138 * Descender :: |
137 /* */ |
139 * The font's descender, i.e., the distance from the baseline to the |
138 /* Descender :: The font's descender, i.e., the distance */ |
140 * bottom-most of all glyph points found in the font. It is negative. |
139 /* from the baseline to the bottom-most of */ |
141 * |
140 /* all glyph points found in the font. It */ |
142 * This value is invalid in many fonts, as it is usually set by the |
141 /* is negative. */ |
143 * font designer, and often reflects only a portion of the glyphs found |
142 /* */ |
144 * in the font (maybe ASCII). |
143 /* This value is invalid in many fonts, as */ |
145 * |
144 /* it is usually set by the font designer, */ |
146 * You should use the `sTypoDescender` field of the 'OS/2' table |
145 /* and often reflects only a portion of the */ |
147 * instead if you want the correct one. |
146 /* glyphs found in the font (maybe ASCII). */ |
148 * |
147 /* */ |
149 * Line_Gap :: |
148 /* You should use the `sTypoDescender' */ |
150 * The font's line gap, i.e., the distance to add to the ascender and |
149 /* field of the `OS/2' table instead if you */ |
151 * descender to get the BTB, i.e., the baseline-to-baseline distance |
150 /* want the correct one. */ |
152 * for the font. |
151 /* */ |
153 * |
152 /* Line_Gap :: The font's line gap, i.e., the distance */ |
154 * advance_Width_Max :: |
153 /* to add to the ascender and descender to */ |
155 * This field is the maximum of all advance widths found in the font. |
154 /* get the BTB, i.e., the */ |
156 * It can be used to compute the maximum width of an arbitrary string |
155 /* baseline-to-baseline distance for the */ |
157 * of text. |
156 /* font. */ |
158 * |
157 /* */ |
159 * min_Left_Side_Bearing :: |
158 /* advance_Width_Max :: This field is the maximum of all advance */ |
160 * The minimum left side bearing of all glyphs within the font. |
159 /* widths found in the font. It can be */ |
161 * |
160 /* used to compute the maximum width of an */ |
162 * min_Right_Side_Bearing :: |
161 /* arbitrary string of text. */ |
163 * The minimum right side bearing of all glyphs within the font. |
162 /* */ |
164 * |
163 /* min_Left_Side_Bearing :: The minimum left side bearing of all */ |
165 * xMax_Extent :: |
164 /* glyphs within the font. */ |
166 * The maximum horizontal extent (i.e., the 'width' of a glyph's |
165 /* */ |
167 * bounding box) for all glyphs in the font. |
166 /* min_Right_Side_Bearing :: The minimum right side bearing of all */ |
168 * |
167 /* glyphs within the font. */ |
169 * caret_Slope_Rise :: |
168 /* */ |
170 * The rise coefficient of the cursor's slope of the cursor |
169 /* xMax_Extent :: The maximum horizontal extent (i.e., the */ |
171 * (slope=rise/run). |
170 /* `width' of a glyph's bounding box) for */ |
172 * |
171 /* all glyphs in the font. */ |
173 * caret_Slope_Run :: |
172 /* */ |
174 * The run coefficient of the cursor's slope. |
173 /* caret_Slope_Rise :: The rise coefficient of the cursor's */ |
175 * |
174 /* slope of the cursor (slope=rise/run). */ |
176 * caret_Offset :: |
175 /* */ |
177 * The cursor's offset for slanted fonts. |
176 /* caret_Slope_Run :: The run coefficient of the cursor's */ |
178 * |
177 /* slope. */ |
179 * Reserved :: |
178 /* */ |
180 * 8~reserved bytes. |
179 /* caret_Offset :: The cursor's offset for slanted fonts. */ |
181 * |
180 /* */ |
182 * metric_Data_Format :: |
181 /* Reserved :: 8~reserved bytes. */ |
183 * Always~0. |
182 /* */ |
184 * |
183 /* metric_Data_Format :: Always~0. */ |
185 * number_Of_HMetrics :: |
184 /* */ |
186 * Number of HMetrics entries in the 'hmtx' table -- this value can be |
185 /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ |
187 * smaller than the total number of glyphs in the font. |
186 /* table -- this value can be smaller than */ |
188 * |
187 /* the total number of glyphs in the font. */ |
189 * long_metrics :: |
188 /* */ |
190 * A pointer into the 'hmtx' table. |
189 /* long_metrics :: A pointer into the `hmtx' table. */ |
191 * |
190 /* */ |
192 * short_metrics :: |
191 /* short_metrics :: A pointer into the `hmtx' table. */ |
193 * A pointer into the 'hmtx' table. |
192 /* */ |
194 * |
193 /* <Note> */ |
195 * @note: |
194 /* For an OpenType variation font, the values of the following fields */ |
196 * For an OpenType variation font, the values of the following fields can |
195 /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ |
197 * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if |
196 /* friends) if the font contains an `MVAR' table: `caret_Slope_Rise', */ |
198 * the font contains an 'MVAR' table: `caret_Slope_Rise`, |
197 /* `caret_Slope_Run', and `caret_Offset'. */ |
199 * `caret_Slope_Run`, and `caret_Offset`. |
198 /* */ |
200 */ |
199 typedef struct TT_HoriHeader_ |
201 typedef struct TT_HoriHeader_ |
200 { |
202 { |
201 FT_Fixed Version; |
203 FT_Fixed Version; |
202 FT_Short Ascender; |
204 FT_Short Ascender; |
203 FT_Short Descender; |
205 FT_Short Descender; |
217 FT_Short metric_Data_Format; |
219 FT_Short metric_Data_Format; |
218 FT_UShort number_Of_HMetrics; |
220 FT_UShort number_Of_HMetrics; |
219 |
221 |
220 /* The following fields are not defined by the OpenType specification */ |
222 /* The following fields are not defined by the OpenType specification */ |
221 /* but they are used to connect the metrics header to the relevant */ |
223 /* but they are used to connect the metrics header to the relevant */ |
222 /* `hmtx' table. */ |
224 /* 'hmtx' table. */ |
223 |
225 |
224 void* long_metrics; |
226 void* long_metrics; |
225 void* short_metrics; |
227 void* short_metrics; |
226 |
228 |
227 } TT_HoriHeader; |
229 } TT_HoriHeader; |
228 |
230 |
229 |
231 |
230 /*************************************************************************/ |
232 /************************************************************************** |
231 /* */ |
233 * |
232 /* <Struct> */ |
234 * @struct: |
233 /* TT_VertHeader */ |
235 * TT_VertHeader |
234 /* */ |
236 * |
235 /* <Description> */ |
237 * @description: |
236 /* A structure used to model a TrueType vertical header, the `vhea' */ |
238 * A structure used to model a TrueType vertical header, the 'vhea' |
237 /* table, as well as the corresponding vertical metrics table, */ |
239 * table, as well as the corresponding vertical metrics table, 'vmtx'. |
238 /* `vmtx'. */ |
240 * |
239 /* */ |
241 * @fields: |
240 /* <Fields> */ |
242 * Version :: |
241 /* Version :: The table version. */ |
243 * The table version. |
242 /* */ |
244 * |
243 /* Ascender :: The font's ascender, i.e., the distance */ |
245 * Ascender :: |
244 /* from the baseline to the top-most of */ |
246 * The font's ascender, i.e., the distance from the baseline to the |
245 /* all glyph points found in the font. */ |
247 * top-most of all glyph points found in the font. |
246 /* */ |
248 * |
247 /* This value is invalid in many fonts, as */ |
249 * This value is invalid in many fonts, as it is usually set by the |
248 /* it is usually set by the font designer, */ |
250 * font designer, and often reflects only a portion of the glyphs found |
249 /* and often reflects only a portion of */ |
251 * in the font (maybe ASCII). |
250 /* the glyphs found in the font (maybe */ |
252 * |
251 /* ASCII). */ |
253 * You should use the `sTypoAscender` field of the 'OS/2' table instead |
252 /* */ |
254 * if you want the correct one. |
253 /* You should use the `sTypoAscender' */ |
255 * |
254 /* field of the `OS/2' table instead if */ |
256 * Descender :: |
255 /* you want the correct one. */ |
257 * The font's descender, i.e., the distance from the baseline to the |
256 /* */ |
258 * bottom-most of all glyph points found in the font. It is negative. |
257 /* Descender :: The font's descender, i.e., the */ |
259 * |
258 /* distance from the baseline to the */ |
260 * This value is invalid in many fonts, as it is usually set by the |
259 /* bottom-most of all glyph points found */ |
261 * font designer, and often reflects only a portion of the glyphs found |
260 /* in the font. It is negative. */ |
262 * in the font (maybe ASCII). |
261 /* */ |
263 * |
262 /* This value is invalid in many fonts, as */ |
264 * You should use the `sTypoDescender` field of the 'OS/2' table |
263 /* it is usually set by the font designer, */ |
265 * instead if you want the correct one. |
264 /* and often reflects only a portion of */ |
266 * |
265 /* the glyphs found in the font (maybe */ |
267 * Line_Gap :: |
266 /* ASCII). */ |
268 * The font's line gap, i.e., the distance to add to the ascender and |
267 /* */ |
269 * descender to get the BTB, i.e., the baseline-to-baseline distance |
268 /* You should use the `sTypoDescender' */ |
270 * for the font. |
269 /* field of the `OS/2' table instead if */ |
271 * |
270 /* you want the correct one. */ |
272 * advance_Height_Max :: |
271 /* */ |
273 * This field is the maximum of all advance heights found in the font. |
272 /* Line_Gap :: The font's line gap, i.e., the distance */ |
274 * It can be used to compute the maximum height of an arbitrary string |
273 /* to add to the ascender and descender to */ |
275 * of text. |
274 /* get the BTB, i.e., the */ |
276 * |
275 /* baseline-to-baseline distance for the */ |
277 * min_Top_Side_Bearing :: |
276 /* font. */ |
278 * The minimum top side bearing of all glyphs within the font. |
277 /* */ |
279 * |
278 /* advance_Height_Max :: This field is the maximum of all */ |
280 * min_Bottom_Side_Bearing :: |
279 /* advance heights found in the font. It */ |
281 * The minimum bottom side bearing of all glyphs within the font. |
280 /* can be used to compute the maximum */ |
282 * |
281 /* height of an arbitrary string of text. */ |
283 * yMax_Extent :: |
282 /* */ |
284 * The maximum vertical extent (i.e., the 'height' of a glyph's |
283 /* min_Top_Side_Bearing :: The minimum top side bearing of all */ |
285 * bounding box) for all glyphs in the font. |
284 /* glyphs within the font. */ |
286 * |
285 /* */ |
287 * caret_Slope_Rise :: |
286 /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ |
288 * The rise coefficient of the cursor's slope of the cursor |
287 /* glyphs within the font. */ |
289 * (slope=rise/run). |
288 /* */ |
290 * |
289 /* yMax_Extent :: The maximum vertical extent (i.e., the */ |
291 * caret_Slope_Run :: |
290 /* `height' of a glyph's bounding box) for */ |
292 * The run coefficient of the cursor's slope. |
291 /* all glyphs in the font. */ |
293 * |
292 /* */ |
294 * caret_Offset :: |
293 /* caret_Slope_Rise :: The rise coefficient of the cursor's */ |
295 * The cursor's offset for slanted fonts. |
294 /* slope of the cursor (slope=rise/run). */ |
296 * |
295 /* */ |
297 * Reserved :: |
296 /* caret_Slope_Run :: The run coefficient of the cursor's */ |
298 * 8~reserved bytes. |
297 /* slope. */ |
299 * |
298 /* */ |
300 * metric_Data_Format :: |
299 /* caret_Offset :: The cursor's offset for slanted fonts. */ |
301 * Always~0. |
300 /* */ |
302 * |
301 /* Reserved :: 8~reserved bytes. */ |
303 * number_Of_VMetrics :: |
302 /* */ |
304 * Number of VMetrics entries in the 'vmtx' table -- this value can be |
303 /* metric_Data_Format :: Always~0. */ |
305 * smaller than the total number of glyphs in the font. |
304 /* */ |
306 * |
305 /* number_Of_VMetrics :: Number of VMetrics entries in the */ |
307 * long_metrics :: |
306 /* `vmtx' table -- this value can be */ |
308 * A pointer into the 'vmtx' table. |
307 /* smaller than the total number of glyphs */ |
309 * |
308 /* in the font. */ |
310 * short_metrics :: |
309 /* */ |
311 * A pointer into the 'vmtx' table. |
310 /* long_metrics :: A pointer into the `vmtx' table. */ |
312 * |
311 /* */ |
313 * @note: |
312 /* short_metrics :: A pointer into the `vmtx' table. */ |
314 * For an OpenType variation font, the values of the following fields can |
313 /* */ |
315 * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if |
314 /* <Note> */ |
316 * the font contains an 'MVAR' table: `Ascender`, `Descender`, |
315 /* For an OpenType variation font, the values of the following fields */ |
317 * `Line_Gap`, `caret_Slope_Rise`, `caret_Slope_Run`, and `caret_Offset`. |
316 /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ |
318 */ |
317 /* friends) if the font contains an `MVAR' table: `Ascender', */ |
|
318 /* `Descender', `Line_Gap', `caret_Slope_Rise', `caret_Slope_Run', */ |
|
319 /* and `caret_Offset'. */ |
|
320 /* */ |
|
321 typedef struct TT_VertHeader_ |
319 typedef struct TT_VertHeader_ |
322 { |
320 { |
323 FT_Fixed Version; |
321 FT_Fixed Version; |
324 FT_Short Ascender; |
322 FT_Short Ascender; |
325 FT_Short Descender; |
323 FT_Short Descender; |
339 FT_Short metric_Data_Format; |
337 FT_Short metric_Data_Format; |
340 FT_UShort number_Of_VMetrics; |
338 FT_UShort number_Of_VMetrics; |
341 |
339 |
342 /* The following fields are not defined by the OpenType specification */ |
340 /* The following fields are not defined by the OpenType specification */ |
343 /* but they are used to connect the metrics header to the relevant */ |
341 /* but they are used to connect the metrics header to the relevant */ |
344 /* `vmtx' table. */ |
342 /* 'vmtx' table. */ |
345 |
343 |
346 void* long_metrics; |
344 void* long_metrics; |
347 void* short_metrics; |
345 void* short_metrics; |
348 |
346 |
349 } TT_VertHeader; |
347 } TT_VertHeader; |
350 |
348 |
351 |
349 |
352 /*************************************************************************/ |
350 /************************************************************************** |
353 /* */ |
351 * |
354 /* <Struct> */ |
352 * @struct: |
355 /* TT_OS2 */ |
353 * TT_OS2 |
356 /* */ |
354 * |
357 /* <Description> */ |
355 * @description: |
358 /* A structure to model a TrueType `OS/2' table. All fields comply */ |
356 * A structure to model a TrueType 'OS/2' table. All fields comply to |
359 /* to the OpenType specification. */ |
357 * the OpenType specification. |
360 /* */ |
358 * |
361 /* Note that we now support old Mac fonts that do not include an */ |
359 * Note that we now support old Mac fonts that do not include an 'OS/2' |
362 /* `OS/2' table. In this case, the `version' field is always set to */ |
360 * table. In this case, the `version` field is always set to 0xFFFF. |
363 /* 0xFFFF. */ |
361 * |
364 /* */ |
362 * @note: |
365 /* <Note> */ |
363 * For an OpenType variation font, the values of the following fields can |
366 /* For an OpenType variation font, the values of the following fields */ |
364 * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if |
367 /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ |
365 * the font contains an 'MVAR' table: `sCapHeight`, `sTypoAscender`, |
368 /* friends) if the font contains an `MVAR' table: `sCapHeight', */ |
366 * `sTypoDescender`, `sTypoLineGap`, `sxHeight`, `usWinAscent`, |
369 /* `sTypoAscender', `sTypoDescender', `sTypoLineGap', `sxHeight', */ |
367 * `usWinDescent`, `yStrikeoutPosition`, `yStrikeoutSize`, |
370 /* `usWinAscent', `usWinDescent', `yStrikeoutPosition', */ |
368 * `ySubscriptXOffset`, `ySubScriptXSize`, `ySubscriptYOffset`, |
371 /* `yStrikeoutSize', `ySubscriptXOffset', `ySubScriptXSize', */ |
369 * `ySubscriptYSize`, `ySuperscriptXOffset`, `ySuperscriptXSize`, |
372 /* `ySubscriptYOffset', `ySubscriptYSize', `ySuperscriptXOffset', */ |
370 * `ySuperscriptYOffset`, and `ySuperscriptYSize`. |
373 /* `ySuperscriptXSize', `ySuperscriptYOffset', and */ |
371 * |
374 /* `ySuperscriptYSize'. */ |
372 * Possible values for bits in the `ulUnicodeRangeX` fields are given by |
375 /* */ |
373 * the @TT_UCR_XXX macros. |
376 /* Possible values for bits in the `ulUnicodeRangeX' fields are given */ |
374 */ |
377 /* by the @TT_UCR_XXX macros. */ |
|
378 /* */ |
|
379 |
375 |
380 typedef struct TT_OS2_ |
376 typedef struct TT_OS2_ |
381 { |
377 { |
382 FT_UShort version; /* 0x0001 - more or 0xFFFF */ |
378 FT_UShort version; /* 0x0001 - more or 0xFFFF */ |
383 FT_Short xAvgCharWidth; |
379 FT_Short xAvgCharWidth; |
433 FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ |
429 FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ |
434 |
430 |
435 } TT_OS2; |
431 } TT_OS2; |
436 |
432 |
437 |
433 |
438 /*************************************************************************/ |
434 /************************************************************************** |
439 /* */ |
435 * |
440 /* <Struct> */ |
436 * @struct: |
441 /* TT_Postscript */ |
437 * TT_Postscript |
442 /* */ |
438 * |
443 /* <Description> */ |
439 * @description: |
444 /* A structure to model a TrueType `post' table. All fields comply */ |
440 * A structure to model a TrueType 'post' table. All fields comply to |
445 /* to the OpenType specification. This structure does not reference */ |
441 * the OpenType specification. This structure does not reference a |
446 /* a font's PostScript glyph names; use @FT_Get_Glyph_Name to */ |
442 * font's PostScript glyph names; use @FT_Get_Glyph_Name to retrieve |
447 /* retrieve them. */ |
443 * them. |
448 /* */ |
444 * |
449 /* <Note> */ |
445 * @note: |
450 /* For an OpenType variation font, the values of the following fields */ |
446 * For an OpenType variation font, the values of the following fields can |
451 /* can change after a call to @FT_Set_Var_Design_Coordinates (and */ |
447 * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if |
452 /* friends) if the font contains an `MVAR' table: `underlinePosition' */ |
448 * the font contains an 'MVAR' table: `underlinePosition` and |
453 /* and `underlineThickness'. */ |
449 * `underlineThickness`. |
454 /* */ |
450 */ |
455 typedef struct TT_Postscript_ |
451 typedef struct TT_Postscript_ |
456 { |
452 { |
457 FT_Fixed FormatType; |
453 FT_Fixed FormatType; |
458 FT_Fixed italicAngle; |
454 FT_Fixed italicAngle; |
459 FT_Short underlinePosition; |
455 FT_Short underlinePosition; |
498 FT_Byte Reserved; |
494 FT_Byte Reserved; |
499 |
495 |
500 } TT_PCLT; |
496 } TT_PCLT; |
501 |
497 |
502 |
498 |
503 /*************************************************************************/ |
499 /************************************************************************** |
504 /* */ |
500 * |
505 /* <Struct> */ |
501 * @struct: |
506 /* TT_MaxProfile */ |
502 * TT_MaxProfile |
507 /* */ |
503 * |
508 /* <Description> */ |
504 * @description: |
509 /* The maximum profile (`maxp') table contains many max values, which */ |
505 * The maximum profile ('maxp') table contains many max values, which can |
510 /* can be used to pre-allocate arrays for speeding up glyph loading */ |
506 * be used to pre-allocate arrays for speeding up glyph loading and |
511 /* and hinting. */ |
507 * hinting. |
512 /* */ |
508 * |
513 /* <Fields> */ |
509 * @fields: |
514 /* version :: The version number. */ |
510 * version :: |
515 /* */ |
511 * The version number. |
516 /* numGlyphs :: The number of glyphs in this TrueType */ |
512 * |
517 /* font. */ |
513 * numGlyphs :: |
518 /* */ |
514 * The number of glyphs in this TrueType font. |
519 /* maxPoints :: The maximum number of points in a */ |
515 * |
520 /* non-composite TrueType glyph. See also */ |
516 * maxPoints :: |
521 /* `maxCompositePoints'. */ |
517 * The maximum number of points in a non-composite TrueType glyph. See |
522 /* */ |
518 * also `maxCompositePoints`. |
523 /* maxContours :: The maximum number of contours in a */ |
519 * |
524 /* non-composite TrueType glyph. See also */ |
520 * maxContours :: |
525 /* `maxCompositeContours'. */ |
521 * The maximum number of contours in a non-composite TrueType glyph. |
526 /* */ |
522 * See also `maxCompositeContours`. |
527 /* maxCompositePoints :: The maximum number of points in a */ |
523 * |
528 /* composite TrueType glyph. See also */ |
524 * maxCompositePoints :: |
529 /* `maxPoints'. */ |
525 * The maximum number of points in a composite TrueType glyph. See |
530 /* */ |
526 * also `maxPoints`. |
531 /* maxCompositeContours :: The maximum number of contours in a */ |
527 * |
532 /* composite TrueType glyph. See also */ |
528 * maxCompositeContours :: |
533 /* `maxContours'. */ |
529 * The maximum number of contours in a composite TrueType glyph. See |
534 /* */ |
530 * also `maxContours`. |
535 /* maxZones :: The maximum number of zones used for */ |
531 * |
536 /* glyph hinting. */ |
532 * maxZones :: |
537 /* */ |
533 * The maximum number of zones used for glyph hinting. |
538 /* maxTwilightPoints :: The maximum number of points in the */ |
534 * |
539 /* twilight zone used for glyph hinting. */ |
535 * maxTwilightPoints :: |
540 /* */ |
536 * The maximum number of points in the twilight zone used for glyph |
541 /* maxStorage :: The maximum number of elements in the */ |
537 * hinting. |
542 /* storage area used for glyph hinting. */ |
538 * |
543 /* */ |
539 * maxStorage :: |
544 /* maxFunctionDefs :: The maximum number of function */ |
540 * The maximum number of elements in the storage area used for glyph |
545 /* definitions in the TrueType bytecode for */ |
541 * hinting. |
546 /* this font. */ |
542 * |
547 /* */ |
543 * maxFunctionDefs :: |
548 /* maxInstructionDefs :: The maximum number of instruction */ |
544 * The maximum number of function definitions in the TrueType bytecode |
549 /* definitions in the TrueType bytecode for */ |
545 * for this font. |
550 /* this font. */ |
546 * |
551 /* */ |
547 * maxInstructionDefs :: |
552 /* maxStackElements :: The maximum number of stack elements used */ |
548 * The maximum number of instruction definitions in the TrueType |
553 /* during bytecode interpretation. */ |
549 * bytecode for this font. |
554 /* */ |
550 * |
555 /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ |
551 * maxStackElements :: |
556 /* used for glyph hinting. */ |
552 * The maximum number of stack elements used during bytecode |
557 /* */ |
553 * interpretation. |
558 /* maxComponentElements :: The maximum number of simple (i.e., non- */ |
554 * |
559 /* composite) glyphs in a composite glyph. */ |
555 * maxSizeOfInstructions :: |
560 /* */ |
556 * The maximum number of TrueType opcodes used for glyph hinting. |
561 /* maxComponentDepth :: The maximum nesting depth of composite */ |
557 * |
562 /* glyphs. */ |
558 * maxComponentElements :: |
563 /* */ |
559 * The maximum number of simple (i.e., non-composite) glyphs in a |
564 /* <Note> */ |
560 * composite glyph. |
565 /* This structure is only used during font loading. */ |
561 * |
566 /* */ |
562 * maxComponentDepth :: |
|
563 * The maximum nesting depth of composite glyphs. |
|
564 * |
|
565 * @note: |
|
566 * This structure is only used during font loading. |
|
567 */ |
567 typedef struct TT_MaxProfile_ |
568 typedef struct TT_MaxProfile_ |
568 { |
569 { |
569 FT_Fixed version; |
570 FT_Fixed version; |
570 FT_UShort numGlyphs; |
571 FT_UShort numGlyphs; |
571 FT_UShort maxPoints; |
572 FT_UShort maxPoints; |
583 FT_UShort maxComponentDepth; |
584 FT_UShort maxComponentDepth; |
584 |
585 |
585 } TT_MaxProfile; |
586 } TT_MaxProfile; |
586 |
587 |
587 |
588 |
588 /*************************************************************************/ |
589 /************************************************************************** |
589 /* */ |
590 * |
590 /* <Enum> */ |
591 * @enum: |
591 /* FT_Sfnt_Tag */ |
592 * FT_Sfnt_Tag |
592 /* */ |
593 * |
593 /* <Description> */ |
594 * @description: |
594 /* An enumeration to specify indices of SFNT tables loaded and parsed */ |
595 * An enumeration to specify indices of SFNT tables loaded and parsed by |
595 /* by FreeType during initialization of an SFNT font. Used in the */ |
596 * FreeType during initialization of an SFNT font. Used in the |
596 /* @FT_Get_Sfnt_Table API function. */ |
597 * @FT_Get_Sfnt_Table API function. |
597 /* */ |
598 * |
598 /* <Values> */ |
599 * @values: |
599 /* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */ |
600 * FT_SFNT_HEAD :: |
600 /* */ |
601 * To access the font's @TT_Header structure. |
601 /* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */ |
602 * |
602 /* */ |
603 * FT_SFNT_MAXP :: |
603 /* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */ |
604 * To access the font's @TT_MaxProfile structure. |
604 /* */ |
605 * |
605 /* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */ |
606 * FT_SFNT_OS2 :: |
606 /* */ |
607 * To access the font's @TT_OS2 structure. |
607 /* FT_SFNT_VHEA :: To access the font's @TT_VertHeader structure. */ |
608 * |
608 /* */ |
609 * FT_SFNT_HHEA :: |
609 /* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */ |
610 * To access the font's @TT_HoriHeader structure. |
610 /* */ |
611 * |
611 /* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */ |
612 * FT_SFNT_VHEA :: |
612 /* */ |
613 * To access the font's @TT_VertHeader structure. |
|
614 * |
|
615 * FT_SFNT_POST :: |
|
616 * To access the font's @TT_Postscript structure. |
|
617 * |
|
618 * FT_SFNT_PCLT :: |
|
619 * To access the font's @TT_PCLT structure. |
|
620 */ |
613 typedef enum FT_Sfnt_Tag_ |
621 typedef enum FT_Sfnt_Tag_ |
614 { |
622 { |
615 FT_SFNT_HEAD, |
623 FT_SFNT_HEAD, |
616 FT_SFNT_MAXP, |
624 FT_SFNT_MAXP, |
617 FT_SFNT_OS2, |
625 FT_SFNT_OS2, |
622 |
630 |
623 FT_SFNT_MAX |
631 FT_SFNT_MAX |
624 |
632 |
625 } FT_Sfnt_Tag; |
633 } FT_Sfnt_Tag; |
626 |
634 |
627 /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */ |
635 /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag` */ |
628 /* values instead */ |
636 /* values instead */ |
629 #define ft_sfnt_head FT_SFNT_HEAD |
637 #define ft_sfnt_head FT_SFNT_HEAD |
630 #define ft_sfnt_maxp FT_SFNT_MAXP |
638 #define ft_sfnt_maxp FT_SFNT_MAXP |
631 #define ft_sfnt_os2 FT_SFNT_OS2 |
639 #define ft_sfnt_os2 FT_SFNT_OS2 |
632 #define ft_sfnt_hhea FT_SFNT_HHEA |
640 #define ft_sfnt_hhea FT_SFNT_HHEA |
633 #define ft_sfnt_vhea FT_SFNT_VHEA |
641 #define ft_sfnt_vhea FT_SFNT_VHEA |
634 #define ft_sfnt_post FT_SFNT_POST |
642 #define ft_sfnt_post FT_SFNT_POST |
635 #define ft_sfnt_pclt FT_SFNT_PCLT |
643 #define ft_sfnt_pclt FT_SFNT_PCLT |
636 |
644 |
637 |
645 |
638 /*************************************************************************/ |
646 /************************************************************************** |
639 /* */ |
647 * |
640 /* <Function> */ |
648 * @function: |
641 /* FT_Get_Sfnt_Table */ |
649 * FT_Get_Sfnt_Table |
642 /* */ |
650 * |
643 /* <Description> */ |
651 * @description: |
644 /* Return a pointer to a given SFNT table stored within a face. */ |
652 * Return a pointer to a given SFNT table stored within a face. |
645 /* */ |
653 * |
646 /* <Input> */ |
654 * @input: |
647 /* face :: A handle to the source. */ |
655 * face :: |
648 /* */ |
656 * A handle to the source. |
649 /* tag :: The index of the SFNT table. */ |
657 * |
650 /* */ |
658 * tag :: |
651 /* <Return> */ |
659 * The index of the SFNT table. |
652 /* A type-less pointer to the table. This will be NULL in case of */ |
660 * |
653 /* error, or if the corresponding table was not found *OR* loaded */ |
661 * @return: |
654 /* from the file. */ |
662 * A type-less pointer to the table. This will be `NULL` in case of |
655 /* */ |
663 * error, or if the corresponding table was not found **OR** loaded from |
656 /* Use a typecast according to `tag' to access the structure */ |
664 * the file. |
657 /* elements. */ |
665 * |
658 /* */ |
666 * Use a typecast according to `tag` to access the structure elements. |
659 /* <Note> */ |
667 * |
660 /* The table is owned by the face object and disappears with it. */ |
668 * @note: |
661 /* */ |
669 * The table is owned by the face object and disappears with it. |
662 /* This function is only useful to access SFNT tables that are loaded */ |
670 * |
663 /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ |
671 * This function is only useful to access SFNT tables that are loaded by |
664 /* a list. */ |
672 * the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for a |
665 /* */ |
673 * list. |
666 /* Here an example how to access the `vhea' table: */ |
674 * |
667 /* */ |
675 * @example: |
668 /* { */ |
676 * Here is an example demonstrating access to the 'vhea' table. |
669 /* TT_VertHeader* vert_header; */ |
677 * |
670 /* */ |
678 * ``` |
671 /* */ |
679 * TT_VertHeader* vert_header; |
672 /* vert_header = */ |
680 * |
673 /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */ |
681 * |
674 /* } */ |
682 * vert_header = |
675 /* */ |
683 * (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); |
|
684 * ``` |
|
685 */ |
676 FT_EXPORT( void* ) |
686 FT_EXPORT( void* ) |
677 FT_Get_Sfnt_Table( FT_Face face, |
687 FT_Get_Sfnt_Table( FT_Face face, |
678 FT_Sfnt_Tag tag ); |
688 FT_Sfnt_Tag tag ); |
679 |
689 |
680 |
690 |
704 * The target buffer address. The client must ensure that the memory |
714 * The target buffer address. The client must ensure that the memory |
705 * array is big enough to hold the data. |
715 * array is big enough to hold the data. |
706 * |
716 * |
707 * @inout: |
717 * @inout: |
708 * length :: |
718 * length :: |
709 * If the `length' parameter is NULL, try to load the whole table. |
719 * If the `length` parameter is `NULL`, try to load the whole table. |
710 * Return an error code if it fails. |
720 * Return an error code if it fails. |
711 * |
721 * |
712 * Else, if `*length' is~0, exit immediately while returning the |
722 * Else, if `*length` is~0, exit immediately while returning the |
713 * table's (or file) full size in it. |
723 * table's (or file) full size in it. |
714 * |
724 * |
715 * Else the number of bytes to read from the table or file, from the |
725 * Else the number of bytes to read from the table or file, from the |
716 * starting offset. |
726 * starting offset. |
717 * |
727 * |
718 * @return: |
728 * @return: |
719 * FreeType error code. 0~means success. |
729 * FreeType error code. 0~means success. |
720 * |
730 * |
721 * @note: |
731 * @note: |
722 * If you need to determine the table's length you should first call this |
732 * If you need to determine the table's length you should first call this |
723 * function with `*length' set to~0, as in the following example: |
733 * function with `*length` set to~0, as in the following example: |
724 * |
734 * |
725 * { |
735 * ``` |
726 * FT_ULong length = 0; |
736 * FT_ULong length = 0; |
727 * |
737 * |
728 * |
738 * |
729 * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); |
739 * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); |
730 * if ( error ) { ... table does not exist ... } |
740 * if ( error ) { ... table does not exist ... } |
731 * |
741 * |
732 * buffer = malloc( length ); |
742 * buffer = malloc( length ); |
733 * if ( buffer == NULL ) { ... not enough memory ... } |
743 * if ( buffer == NULL ) { ... not enough memory ... } |
734 * |
744 * |
735 * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); |
745 * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); |
736 * if ( error ) { ... could not load table ... } |
746 * if ( error ) { ... could not load table ... } |
737 * } |
747 * ``` |
738 * |
748 * |
739 * Note that structures like @TT_Header or @TT_OS2 can't be used with |
749 * Note that structures like @TT_Header or @TT_OS2 can't be used with |
740 * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that |
750 * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that |
741 * those structures depend on the processor architecture, with varying |
751 * those structures depend on the processor architecture, with varying |
742 * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). |
752 * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). |
790 FT_UInt table_index, |
800 FT_UInt table_index, |
791 FT_ULong *tag, |
801 FT_ULong *tag, |
792 FT_ULong *length ); |
802 FT_ULong *length ); |
793 |
803 |
794 |
804 |
795 /*************************************************************************/ |
805 /************************************************************************** |
796 /* */ |
806 * |
797 /* <Function> */ |
807 * @function: |
798 /* FT_Get_CMap_Language_ID */ |
808 * FT_Get_CMap_Language_ID |
799 /* */ |
809 * |
800 /* <Description> */ |
810 * @description: |
801 /* Return cmap language ID as specified in the OpenType standard. */ |
811 * Return cmap language ID as specified in the OpenType standard. |
802 /* Definitions of language ID values are in file @FT_TRUETYPE_IDS_H. */ |
812 * Definitions of language ID values are in file @FT_TRUETYPE_IDS_H. |
803 /* */ |
813 * |
804 /* <Input> */ |
814 * @input: |
805 /* charmap :: */ |
815 * charmap :: |
806 /* The target charmap. */ |
816 * The target charmap. |
807 /* */ |
817 * |
808 /* <Return> */ |
818 * @return: |
809 /* The language ID of `charmap'. If `charmap' doesn't belong to an */ |
819 * The language ID of `charmap`. If `charmap` doesn't belong to an SFNT |
810 /* SFNT face, just return~0 as the default value. */ |
820 * face, just return~0 as the default value. |
811 /* */ |
821 * |
812 /* For a format~14 cmap (to access Unicode IVS), the return value is */ |
822 * For a format~14 cmap (to access Unicode IVS), the return value is |
813 /* 0xFFFFFFFF. */ |
823 * 0xFFFFFFFF. |
814 /* */ |
824 */ |
815 FT_EXPORT( FT_ULong ) |
825 FT_EXPORT( FT_ULong ) |
816 FT_Get_CMap_Language_ID( FT_CharMap charmap ); |
826 FT_Get_CMap_Language_ID( FT_CharMap charmap ); |
817 |
827 |
818 |
828 |
819 /*************************************************************************/ |
829 /************************************************************************** |
820 /* */ |
830 * |
821 /* <Function> */ |
831 * @function: |
822 /* FT_Get_CMap_Format */ |
832 * FT_Get_CMap_Format |
823 /* */ |
833 * |
824 /* <Description> */ |
834 * @description: |
825 /* Return the format of an SFNT `cmap' table. */ |
835 * Return the format of an SFNT 'cmap' table. |
826 /* */ |
836 * |
827 /* <Input> */ |
837 * @input: |
828 /* charmap :: */ |
838 * charmap :: |
829 /* The target charmap. */ |
839 * The target charmap. |
830 /* */ |
840 * |
831 /* <Return> */ |
841 * @return: |
832 /* The format of `charmap'. If `charmap' doesn't belong to an SFNT */ |
842 * The format of `charmap`. If `charmap` doesn't belong to an SFNT face, |
833 /* face, return -1. */ |
843 * return -1. |
834 /* */ |
844 */ |
835 FT_EXPORT( FT_Long ) |
845 FT_EXPORT( FT_Long ) |
836 FT_Get_CMap_Format( FT_CharMap charmap ); |
846 FT_Get_CMap_Format( FT_CharMap charmap ); |
837 |
847 |
838 /* */ |
848 /* */ |
839 |
849 |