1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* ttgxvar.h */ |
3 * ttgxvar.h |
4 /* */ |
4 * |
5 /* TrueType GX Font Variation loader (specification) */ |
5 * TrueType GX Font Variation loader (specification) |
6 /* */ |
6 * |
7 /* Copyright 2004-2018 by */ |
7 * Copyright (C) 2004-2019 by |
8 /* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ |
8 * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. |
9 /* */ |
9 * |
10 /* This file is part of the FreeType project, and may only be used, */ |
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 */ |
11 * modified, and distributed under the terms of the FreeType project |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
13 /* this file you indicate that you have read the license and */ |
13 * this file you indicate that you have read the license and |
14 /* understand and accept it fully. */ |
14 * understand and accept it fully. |
15 /* */ |
15 * |
16 /***************************************************************************/ |
16 */ |
17 |
17 |
18 |
18 |
19 #ifndef TTGXVAR_H_ |
19 #ifndef TTGXVAR_H_ |
20 #define TTGXVAR_H_ |
20 #define TTGXVAR_H_ |
21 |
21 |
27 FT_BEGIN_HEADER |
27 FT_BEGIN_HEADER |
28 |
28 |
29 |
29 |
30 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT |
30 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT |
31 |
31 |
32 /*************************************************************************/ |
32 /************************************************************************** |
33 /* */ |
33 * |
34 /* <Struct> */ |
34 * @Struct: |
35 /* GX_AVarCorrespondenceRec */ |
35 * GX_AVarCorrespondenceRec |
36 /* */ |
36 * |
37 /* <Description> */ |
37 * @Description: |
38 /* A data structure representing `shortFracCorrespondence' in `avar' */ |
38 * A data structure representing `shortFracCorrespondence' in `avar' |
39 /* table according to the specifications from Apple. */ |
39 * table according to the specifications from Apple. |
40 /* */ |
40 */ |
41 typedef struct GX_AVarCorrespondenceRec_ |
41 typedef struct GX_AVarCorrespondenceRec_ |
42 { |
42 { |
43 FT_Fixed fromCoord; |
43 FT_Fixed fromCoord; |
44 FT_Fixed toCoord; |
44 FT_Fixed toCoord; |
45 |
45 |
46 } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence; |
46 } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence; |
47 |
47 |
48 |
48 |
49 /*************************************************************************/ |
49 /************************************************************************** |
50 /* */ |
50 * |
51 /* <Struct> */ |
51 * @Struct: |
52 /* GX_AVarRec */ |
52 * GX_AVarRec |
53 /* */ |
53 * |
54 /* <Description> */ |
54 * @Description: |
55 /* Data from the segment field of `avar' table. */ |
55 * Data from the segment field of `avar' table. |
56 /* There is one of these for each axis. */ |
56 * There is one of these for each axis. |
57 /* */ |
57 */ |
58 typedef struct GX_AVarSegmentRec_ |
58 typedef struct GX_AVarSegmentRec_ |
59 { |
59 { |
60 FT_UShort pairCount; |
60 FT_UShort pairCount; |
61 GX_AVarCorrespondence correspondence; /* array with pairCount entries */ |
61 GX_AVarCorrespondence correspondence; /* array with pairCount entries */ |
62 |
62 |
189 FT_Short unmodified; /* values are either FT_Short or FT_UShort */ |
189 FT_Short unmodified; /* values are either FT_Short or FT_UShort */ |
190 |
190 |
191 } GX_ValueRec, *GX_Value; |
191 } GX_ValueRec, *GX_Value; |
192 |
192 |
193 |
193 |
194 /*************************************************************************/ |
194 /************************************************************************** |
195 /* */ |
195 * |
196 /* <Struct> */ |
196 * @Struct: |
197 /* GX_MVarTableRec */ |
197 * GX_MVarTableRec |
198 /* */ |
198 * |
199 /* <Description> */ |
199 * @Description: |
200 /* Data from the `MVAR' table. */ |
200 * Data from the `MVAR' table. |
201 /* */ |
201 */ |
202 typedef struct GX_MVarTableRec_ |
202 typedef struct GX_MVarTableRec_ |
203 { |
203 { |
204 FT_UShort valueCount; |
204 FT_UShort valueCount; |
205 |
205 |
206 GX_ItemVarStoreRec itemStore; /* Item Variation Store */ |
206 GX_ItemVarStoreRec itemStore; /* Item Variation Store */ |
207 GX_Value values; /* Value Records */ |
207 GX_Value values; /* Value Records */ |
208 |
208 |
209 } GX_MVarTableRec, *GX_MVarTable; |
209 } GX_MVarTableRec, *GX_MVarTable; |
210 |
210 |
211 |
211 |
212 /*************************************************************************/ |
212 /************************************************************************** |
213 /* */ |
213 * |
214 /* <Struct> */ |
214 * @Struct: |
215 /* GX_BlendRec */ |
215 * GX_BlendRec |
216 /* */ |
216 * |
217 /* <Description> */ |
217 * @Description: |
218 /* Data for interpolating a font from a distortable font specified */ |
218 * Data for interpolating a font from a distortable font specified |
219 /* by the GX *var tables ([fgcahvm]var). */ |
219 * by the GX *var tables ([fgcahvm]var). |
220 /* */ |
220 * |
221 /* <Fields> */ |
221 * @Fields: |
222 /* num_axis :: */ |
222 * num_axis :: |
223 /* The number of axes along which interpolation may happen. */ |
223 * The number of axes along which interpolation may happen. |
224 /* */ |
224 * |
225 /* coords :: */ |
225 * coords :: |
226 /* An array of design coordinates (in user space) indicating the */ |
226 * An array of design coordinates (in user space) indicating the |
227 /* contribution along each axis to the final interpolated font. */ |
227 * contribution along each axis to the final interpolated font. |
228 /* `normalizedcoords' holds the same values. */ |
228 * `normalizedcoords' holds the same values. |
229 /* */ |
229 * |
230 /* normalizedcoords :: */ |
230 * normalizedcoords :: |
231 /* An array of normalized values (between [-1,1]) indicating the */ |
231 * An array of normalized values (between [-1,1]) indicating the |
232 /* contribution along each axis to the final interpolated font. */ |
232 * contribution along each axis to the final interpolated font. |
233 /* `coords' holds the same values. */ |
233 * `coords' holds the same values. |
234 /* */ |
234 * |
235 /* mmvar :: */ |
235 * mmvar :: |
236 /* Data from the `fvar' table. */ |
236 * Data from the `fvar' table. |
237 /* */ |
237 * |
238 /* mmvar_len :: */ |
238 * mmvar_len :: |
239 /* The length of the `mmvar' structure. */ |
239 * The length of the `mmvar' structure. |
240 /* */ |
240 * |
241 /* normalized_stylecoords :: */ |
241 * normalized_stylecoords :: |
242 /* A two-dimensional array that holds the named instance data from */ |
242 * A two-dimensional array that holds the named instance data from |
243 /* `mmvar' as normalized values. */ |
243 * `mmvar' as normalized values. |
244 /* */ |
244 * |
245 /* avar_loaded :: */ |
245 * avar_loaded :: |
246 /* A Boolean; if set, FreeType tried to load (and parse) the `avar' */ |
246 * A Boolean; if set, FreeType tried to load (and parse) the `avar' |
247 /* table. */ |
247 * table. |
248 /* */ |
248 * |
249 /* avar_segment :: */ |
249 * avar_segment :: |
250 /* Data from the `avar' table. */ |
250 * Data from the `avar' table. |
251 /* */ |
251 * |
252 /* hvar_loaded :: */ |
252 * hvar_loaded :: |
253 /* A Boolean; if set, FreeType tried to load (and parse) the `hvar' */ |
253 * A Boolean; if set, FreeType tried to load (and parse) the `hvar' |
254 /* table. */ |
254 * table. |
255 /* */ |
255 * |
256 /* hvar_checked :: */ |
256 * hvar_checked :: |
257 /* A Boolean; if set, FreeType successfully loaded and parsed the */ |
257 * A Boolean; if set, FreeType successfully loaded and parsed the |
258 /* `hvar' table. */ |
258 * `hvar' table. |
259 /* */ |
259 * |
260 /* hvar_error :: */ |
260 * hvar_error :: |
261 /* If loading and parsing of the `hvar' table failed, this field */ |
261 * If loading and parsing of the `hvar' table failed, this field |
262 /* holds the corresponding error code. */ |
262 * holds the corresponding error code. |
263 /* */ |
263 * |
264 /* hvar_table :: */ |
264 * hvar_table :: |
265 /* Data from the `hvar' table. */ |
265 * Data from the `hvar' table. |
266 /* */ |
266 * |
267 /* vvar_loaded :: */ |
267 * vvar_loaded :: |
268 /* A Boolean; if set, FreeType tried to load (and parse) the `vvar' */ |
268 * A Boolean; if set, FreeType tried to load (and parse) the `vvar' |
269 /* table. */ |
269 * table. |
270 /* */ |
270 * |
271 /* vvar_checked :: */ |
271 * vvar_checked :: |
272 /* A Boolean; if set, FreeType successfully loaded and parsed the */ |
272 * A Boolean; if set, FreeType successfully loaded and parsed the |
273 /* `vvar' table. */ |
273 * `vvar' table. |
274 /* */ |
274 * |
275 /* vvar_error :: */ |
275 * vvar_error :: |
276 /* If loading and parsing of the `vvar' table failed, this field */ |
276 * If loading and parsing of the `vvar' table failed, this field |
277 /* holds the corresponding error code. */ |
277 * holds the corresponding error code. |
278 /* */ |
278 * |
279 /* vvar_table :: */ |
279 * vvar_table :: |
280 /* Data from the `vvar' table. */ |
280 * Data from the `vvar' table. |
281 /* */ |
281 * |
282 /* mvar_table :: */ |
282 * mvar_table :: |
283 /* Data from the `mvar' table. */ |
283 * Data from the `mvar' table. |
284 /* */ |
284 * |
285 /* tuplecount :: */ |
285 * tuplecount :: |
286 /* The number of shared tuples in the `gvar' table. */ |
286 * The number of shared tuples in the `gvar' table. |
287 /* */ |
287 * |
288 /* tuplecoords :: */ |
288 * tuplecoords :: |
289 /* A two-dimensional array that holds the shared tuple coordinates */ |
289 * A two-dimensional array that holds the shared tuple coordinates |
290 /* in the `gvar' table. */ |
290 * in the `gvar' table. |
291 /* */ |
291 * |
292 /* gv_glyphcnt :: */ |
292 * gv_glyphcnt :: |
293 /* The number of glyphs handled in the `gvar' table. */ |
293 * The number of glyphs handled in the `gvar' table. |
294 /* */ |
294 * |
295 /* glyphoffsets :: */ |
295 * glyphoffsets :: |
296 /* Offsets into the glyph variation data array. */ |
296 * Offsets into the glyph variation data array. |
297 /* */ |
297 * |
298 /* gvar_size :: */ |
298 * gvar_size :: |
299 /* The size of the `gvar' table. */ |
299 * The size of the `gvar' table. |
300 /* */ |
300 */ |
301 typedef struct GX_BlendRec_ |
301 typedef struct GX_BlendRec_ |
302 { |
302 { |
303 FT_UInt num_axis; |
303 FT_UInt num_axis; |
304 FT_Fixed* coords; |
304 FT_Fixed* coords; |
305 FT_Fixed* normalizedcoords; |
305 FT_Fixed* normalizedcoords; |
334 FT_ULong gvar_size; |
334 FT_ULong gvar_size; |
335 |
335 |
336 } GX_BlendRec; |
336 } GX_BlendRec; |
337 |
337 |
338 |
338 |
339 /*************************************************************************/ |
339 /************************************************************************** |
340 /* */ |
340 * |
341 /* <enum> */ |
341 * @enum: |
342 /* GX_TupleCountFlags */ |
342 * GX_TupleCountFlags |
343 /* */ |
343 * |
344 /* <Description> */ |
344 * @Description: |
345 /* Flags used within the `TupleCount' field of the `gvar' table. */ |
345 * Flags used within the `TupleCount' field of the `gvar' table. |
346 /* */ |
346 */ |
347 typedef enum GX_TupleCountFlags_ |
347 typedef enum GX_TupleCountFlags_ |
348 { |
348 { |
349 GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000, |
349 GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000, |
350 GX_TC_RESERVED_TUPLE_FLAGS = 0x7000, |
350 GX_TC_RESERVED_TUPLE_FLAGS = 0x7000, |
351 GX_TC_TUPLE_COUNT_MASK = 0x0FFF |
351 GX_TC_TUPLE_COUNT_MASK = 0x0FFF |
352 |
352 |
353 } GX_TupleCountFlags; |
353 } GX_TupleCountFlags; |
354 |
354 |
355 |
355 |
356 /*************************************************************************/ |
356 /************************************************************************** |
357 /* */ |
357 * |
358 /* <enum> */ |
358 * @enum: |
359 /* GX_TupleIndexFlags */ |
359 * GX_TupleIndexFlags |
360 /* */ |
360 * |
361 /* <Description> */ |
361 * @Description: |
362 /* Flags used within the `TupleIndex' field of the `gvar' and `cvar' */ |
362 * Flags used within the `TupleIndex' field of the `gvar' and `cvar' |
363 /* tables. */ |
363 * tables. |
364 /* */ |
364 */ |
365 typedef enum GX_TupleIndexFlags_ |
365 typedef enum GX_TupleIndexFlags_ |
366 { |
366 { |
367 GX_TI_EMBEDDED_TUPLE_COORD = 0x8000, |
367 GX_TI_EMBEDDED_TUPLE_COORD = 0x8000, |
368 GX_TI_INTERMEDIATE_TUPLE = 0x4000, |
368 GX_TI_INTERMEDIATE_TUPLE = 0x4000, |
369 GX_TI_PRIVATE_POINT_NUMBERS = 0x2000, |
369 GX_TI_PRIVATE_POINT_NUMBERS = 0x2000, |