1 /***************************************************************************/
5 /* FreeType Multiple Master font interface (specification). */
7 /* Copyright 1996-2017 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 /***************************************************************************/
24 #include FT_TYPE1_TABLES_H
30 /*************************************************************************/
33 /* multiple_masters */
36 /* Multiple Masters */
39 /* How to manage Multiple Masters fonts. */
42 /* The following types and functions are used to manage Multiple */
43 /* Master fonts, i.e., the selection of specific design instances by */
44 /* setting design axis coordinates. */
46 /* Besides Adobe MM fonts, the interface supports Apple's TrueType GX */
47 /* and OpenType variation fonts. Some of the routines only work with */
48 /* Adobe MM fonts, others will work with all three types. They are */
49 /* similar enough that a consistent interface makes sense. */
51 /*************************************************************************/
54 /*************************************************************************/
60 /* A structure to model a given axis in design space for Multiple */
63 /* This structure can't be used for TrueType GX or OpenType variation */
67 /* name :: The axis's name. */
69 /* minimum :: The axis's minimum design coordinate. */
71 /* maximum :: The axis's maximum design coordinate. */
73 typedef struct FT_MM_Axis_
82 /*************************************************************************/
88 /* A structure to model the axes and space of a Multiple Masters */
91 /* This structure can't be used for TrueType GX or OpenType variation */
95 /* num_axis :: Number of axes. Cannot exceed~4. */
97 /* num_designs :: Number of designs; should be normally 2^num_axis */
98 /* even though the Type~1 specification strangely */
99 /* allows for intermediate designs to be present. */
100 /* This number cannot exceed~16. */
102 /* axis :: A table of axis descriptors. */
104 typedef struct FT_Multi_Master_
108 FT_MM_Axis axis[T1_MAX_MM_AXIS];
113 /*************************************************************************/
119 /* A structure to model a given axis in design space for Multiple */
120 /* Masters, TrueType GX, and OpenType variation fonts. */
123 /* name :: The axis's name. */
124 /* Not always meaningful for TrueType GX or OpenType */
125 /* variation fonts. */
127 /* minimum :: The axis's minimum design coordinate. */
129 /* def :: The axis's default design coordinate. */
130 /* FreeType computes meaningful default values for Adobe */
133 /* maximum :: The axis's maximum design coordinate. */
135 /* tag :: The axis's tag (the equivalent to `name' for TrueType */
136 /* GX and OpenType variation fonts). FreeType provides */
137 /* default values for Adobe MM fonts if possible. */
139 /* strid :: The axis name entry in the font's `name' table. This */
140 /* is another (and often better) version of the `name' */
141 /* field for TrueType GX or OpenType variation fonts. Not */
142 /* meaningful for Adobe MM fonts. */
145 /* The fields `minimum', `def', and `maximum' are 16.16 fractional */
146 /* values for TrueType GX and OpenType variation fonts. For Adobe MM */
147 /* fonts, the values are integers. */
149 typedef struct FT_Var_Axis_
163 /*************************************************************************/
166 /* FT_Var_Named_Style */
169 /* A structure to model a named instance in a TrueType GX or OpenType */
170 /* variation font. */
172 /* This structure can't be used for Adobe MM fonts. */
175 /* coords :: The design coordinates for this instance. */
176 /* This is an array with one entry for each axis. */
178 /* strid :: The entry in `name' table identifying this instance. */
180 /* psid :: The entry in `name' table identifying a PostScript name */
181 /* for this instance. */
183 typedef struct FT_Var_Named_Style_
187 FT_UInt psid; /* since 2.7.1 */
189 } FT_Var_Named_Style;
192 /*************************************************************************/
198 /* A structure to model the axes and space of a Adobe MM, TrueType */
199 /* GX, or OpenType variation font. */
201 /* Some fields are specific to one format and not to the others. */
204 /* num_axis :: The number of axes. The maximum value is~4 for */
205 /* Adobe MM fonts; no limit in TrueType GX or */
206 /* OpenType variation fonts. */
208 /* num_designs :: The number of designs; should be normally */
209 /* 2^num_axis for Adobe MM fonts. Not meaningful */
210 /* for TrueType GX or OpenType variation fonts */
211 /* (where every glyph could have a different */
212 /* number of designs). */
214 /* num_namedstyles :: The number of named styles; a `named style' is */
215 /* a tuple of design coordinates that has a string */
216 /* ID (in the `name' table) associated with it. */
217 /* The font can tell the user that, for example, */
218 /* [Weight=1.5,Width=1.1] is `Bold'. Another name */
219 /* for `named style' is `named instance'. */
221 /* For Adobe Multiple Masters fonts, this value is */
222 /* always zero because the format does not support */
225 /* axis :: An axis descriptor table. */
226 /* TrueType GX and OpenType variation fonts */
227 /* contain slightly more data than Adobe MM fonts. */
228 /* Memory management of this pointer is done */
229 /* internally by FreeType. */
231 /* namedstyle :: A named style (instance) table. */
232 /* Only meaningful for TrueType GX and OpenType */
233 /* variation fonts. Memory management of this */
234 /* pointer is done internally by FreeType. */
236 typedef struct FT_MM_Var_
240 FT_UInt num_namedstyles;
242 FT_Var_Named_Style* namedstyle;
247 /*************************************************************************/
250 /* FT_Get_Multi_Master */
253 /* Retrieve a variation descriptor of a given Adobe MM font. */
255 /* This function can't be used with TrueType GX or OpenType variation */
259 /* face :: A handle to the source face. */
262 /* amaster :: The Multiple Masters descriptor. */
265 /* FreeType error code. 0~means success. */
267 FT_EXPORT( FT_Error )
268 FT_Get_Multi_Master( FT_Face face,
269 FT_Multi_Master *amaster );
272 /*************************************************************************/
278 /* Retrieve a variation descriptor for a given font. */
280 /* This function works with all supported variation formats. */
283 /* face :: A handle to the source face. */
286 /* amaster :: The variation descriptor. */
287 /* Allocates a data structure, which the user must */
288 /* deallocate with `free' after use. */
291 /* FreeType error code. 0~means success. */
293 FT_EXPORT( FT_Error )
294 FT_Get_MM_Var( FT_Face face,
295 FT_MM_Var* *amaster );
298 /*************************************************************************/
301 /* FT_Set_MM_Design_Coordinates */
304 /* For Adobe MM fonts, choose an interpolated font design through */
305 /* design coordinates. */
307 /* This function can't be used with TrueType GX or OpenType variation */
311 /* face :: A handle to the source face. */
314 /* num_coords :: The number of available design coordinates. If it */
315 /* is larger than the number of axes, ignore the excess */
316 /* values. If it is smaller than the number of axes, */
317 /* use default values for the remaining axes. */
319 /* coords :: An array of design coordinates. */
322 /* FreeType error code. 0~means success. */
324 FT_EXPORT( FT_Error )
325 FT_Set_MM_Design_Coordinates( FT_Face face,
330 /*************************************************************************/
333 /* FT_Set_Var_Design_Coordinates */
336 /* Choose an interpolated font design through design coordinates. */
338 /* This function works with all supported variation formats. */
341 /* face :: A handle to the source face. */
344 /* num_coords :: The number of available design coordinates. If it */
345 /* is larger than the number of axes, ignore the excess */
346 /* values. If it is smaller than the number of axes, */
347 /* use default values for the remaining axes. */
349 /* coords :: An array of design coordinates. */
352 /* FreeType error code. 0~means success. */
354 FT_EXPORT( FT_Error )
355 FT_Set_Var_Design_Coordinates( FT_Face face,
360 /*************************************************************************/
363 /* FT_Get_Var_Design_Coordinates */
366 /* Get the design coordinates of the currently selected interpolated */
369 /* This function works with all supported variation formats. */
372 /* face :: A handle to the source face. */
374 /* num_coords :: The number of design coordinates to retrieve. If it */
375 /* is larger than the number of axes, set the excess */
379 /* coords :: The design coordinates array. */
382 /* FreeType error code. 0~means success. */
384 FT_EXPORT( FT_Error )
385 FT_Get_Var_Design_Coordinates( FT_Face face,
390 /*************************************************************************/
393 /* FT_Set_MM_Blend_Coordinates */
396 /* Choose an interpolated font design through normalized blend */
399 /* This function works with all supported variation formats. */
402 /* face :: A handle to the source face. */
405 /* num_coords :: The number of available design coordinates. If it */
406 /* is larger than the number of axes, ignore the excess */
407 /* values. If it is smaller than the number of axes, */
408 /* use default values for the remaining axes. */
410 /* coords :: The design coordinates array (each element must be */
411 /* between 0 and 1.0 for Adobe MM fonts, and between */
412 /* -1.0 and 1.0 for TrueType GX and OpenType variation */
416 /* FreeType error code. 0~means success. */
418 FT_EXPORT( FT_Error )
419 FT_Set_MM_Blend_Coordinates( FT_Face face,
424 /*************************************************************************/
427 /* FT_Get_MM_Blend_Coordinates */
430 /* Get the normalized blend coordinates of the currently selected */
431 /* interpolated font. */
433 /* This function works with all supported variation formats. */
436 /* face :: A handle to the source face. */
438 /* num_coords :: The number of normalized blend coordinates to */
439 /* retrieve. If it is larger than the number of axes, */
440 /* set the excess values to~0.5 for Adobe MM fonts, and */
441 /* to~0 for TrueType GX and OpenType variation fonts. */
444 /* coords :: The normalized blend coordinates array. */
447 /* FreeType error code. 0~means success. */
449 FT_EXPORT( FT_Error )
450 FT_Get_MM_Blend_Coordinates( FT_Face face,
455 /*************************************************************************/
458 /* FT_Set_Var_Blend_Coordinates */
461 /* This is another name of @FT_Set_MM_Blend_Coordinates. */
463 FT_EXPORT( FT_Error )
464 FT_Set_Var_Blend_Coordinates( FT_Face face,
469 /*************************************************************************/
472 /* FT_Get_Var_Blend_Coordinates */
475 /* This is another name of @FT_Get_MM_Blend_Coordinates. */
477 FT_EXPORT( FT_Error )
478 FT_Get_Var_Blend_Coordinates( FT_Face face,