michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* ftmm.h */ michael@0: /* */ michael@0: /* FreeType Multiple Master font interface (specification). */ michael@0: /* */ michael@0: /* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTMM_H__ michael@0: #define __FTMM_H__ michael@0: michael@0: michael@0: #include michael@0: #include FT_TYPE1_TABLES_H michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /*
*/ michael@0: /* multiple_masters */ michael@0: /* */ michael@0: /* */ michael@0: /* Multiple Masters */ michael@0: /* */ michael@0: /* <Abstract> */ michael@0: /* How to manage Multiple Masters fonts. */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* The following types and functions are used to manage Multiple */ michael@0: /* Master fonts, i.e., the selection of specific design instances by */ michael@0: /* setting design axis coordinates. */ michael@0: /* */ michael@0: /* George Williams has extended this interface to make it work with */ michael@0: /* both Type~1 Multiple Masters fonts and GX distortable (var) */ michael@0: /* fonts. Some of these routines only work with MM fonts, others */ michael@0: /* will work with both types. They are similar enough that a */ michael@0: /* consistent interface makes sense. */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_MM_Axis */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple structure used to model a given axis in design space for */ michael@0: /* Multiple Masters fonts. */ michael@0: /* */ michael@0: /* This structure can't be used for GX var fonts. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* name :: The axis's name. */ michael@0: /* */ michael@0: /* minimum :: The axis's minimum design coordinate. */ michael@0: /* */ michael@0: /* maximum :: The axis's maximum design coordinate. */ michael@0: /* */ michael@0: typedef struct FT_MM_Axis_ michael@0: { michael@0: FT_String* name; michael@0: FT_Long minimum; michael@0: FT_Long maximum; michael@0: michael@0: } FT_MM_Axis; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Multi_Master */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model the axes and space of a Multiple Masters */ michael@0: /* font. */ michael@0: /* */ michael@0: /* This structure can't be used for GX var fonts. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* num_axis :: Number of axes. Cannot exceed~4. */ michael@0: /* */ michael@0: /* num_designs :: Number of designs; should be normally 2^num_axis */ michael@0: /* even though the Type~1 specification strangely */ michael@0: /* allows for intermediate designs to be present. This */ michael@0: /* number cannot exceed~16. */ michael@0: /* */ michael@0: /* axis :: A table of axis descriptors. */ michael@0: /* */ michael@0: typedef struct FT_Multi_Master_ michael@0: { michael@0: FT_UInt num_axis; michael@0: FT_UInt num_designs; michael@0: FT_MM_Axis axis[T1_MAX_MM_AXIS]; michael@0: michael@0: } FT_Multi_Master; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Var_Axis */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple structure used to model a given axis in design space for */ michael@0: /* Multiple Masters and GX var fonts. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* name :: The axis's name. */ michael@0: /* Not always meaningful for GX. */ michael@0: /* */ michael@0: /* minimum :: The axis's minimum design coordinate. */ michael@0: /* */ michael@0: /* def :: The axis's default design coordinate. */ michael@0: /* FreeType computes meaningful default values for MM; it */ michael@0: /* is then an integer value, not in 16.16 format. */ michael@0: /* */ michael@0: /* maximum :: The axis's maximum design coordinate. */ michael@0: /* */ michael@0: /* tag :: The axis's tag (the GX equivalent to `name'). */ michael@0: /* FreeType provides default values for MM if possible. */ michael@0: /* */ michael@0: /* strid :: The entry in `name' table (another GX version of */ michael@0: /* `name'). */ michael@0: /* Not meaningful for MM. */ michael@0: /* */ michael@0: typedef struct FT_Var_Axis_ michael@0: { michael@0: FT_String* name; michael@0: michael@0: FT_Fixed minimum; michael@0: FT_Fixed def; michael@0: FT_Fixed maximum; michael@0: michael@0: FT_ULong tag; michael@0: FT_UInt strid; michael@0: michael@0: } FT_Var_Axis; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Var_Named_Style */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A simple structure used to model a named style in a GX var font. */ michael@0: /* */ michael@0: /* This structure can't be used for MM fonts. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* coords :: The design coordinates for this style. */ michael@0: /* This is an array with one entry for each axis. */ michael@0: /* */ michael@0: /* strid :: The entry in `name' table identifying this style. */ michael@0: /* */ michael@0: typedef struct FT_Var_Named_Style_ michael@0: { michael@0: FT_Fixed* coords; michael@0: FT_UInt strid; michael@0: michael@0: } FT_Var_Named_Style; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_MM_Var */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model the axes and space of a Multiple Masters */ michael@0: /* or GX var distortable font. */ michael@0: /* */ michael@0: /* Some fields are specific to one format and not to the other. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* num_axis :: The number of axes. The maximum value is~4 for */ michael@0: /* MM; no limit in GX. */ michael@0: /* */ michael@0: /* num_designs :: The number of designs; should be normally */ michael@0: /* 2^num_axis for MM fonts. Not meaningful for GX */ michael@0: /* (where every glyph could have a different */ michael@0: /* number of designs). */ michael@0: /* */ michael@0: /* num_namedstyles :: The number of named styles; only meaningful for */ michael@0: /* GX that allows certain design coordinates to */ michael@0: /* have a string ID (in the `name' table) */ michael@0: /* associated with them. The font can tell the */ michael@0: /* user that, for example, Weight=1.5 is `Bold'. */ michael@0: /* */ michael@0: /* axis :: A table of axis descriptors. */ michael@0: /* GX fonts contain slightly more data than MM. */ michael@0: /* */ michael@0: /* namedstyles :: A table of named styles. */ michael@0: /* Only meaningful with GX. */ michael@0: /* */ michael@0: typedef struct FT_MM_Var_ michael@0: { michael@0: FT_UInt num_axis; michael@0: FT_UInt num_designs; michael@0: FT_UInt num_namedstyles; michael@0: FT_Var_Axis* axis; michael@0: FT_Var_Named_Style* namedstyle; michael@0: michael@0: } FT_MM_Var; michael@0: michael@0: michael@0: /* */ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_Multi_Master */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Retrieve the Multiple Master descriptor of a given font. */ michael@0: /* */ michael@0: /* This function can't be used with GX fonts. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* face :: A handle to the source face. */ michael@0: /* */ michael@0: /* <Output> */ michael@0: /* amaster :: The Multiple Masters descriptor. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Get_Multi_Master( FT_Face face, michael@0: FT_Multi_Master *amaster ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_MM_Var */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Retrieve the Multiple Master/GX var descriptor of a given font. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* face :: A handle to the source face. */ michael@0: /* */ michael@0: /* <Output> */ michael@0: /* amaster :: The Multiple Masters/GX var descriptor. */ michael@0: /* Allocates a data structure, which the user must free. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Get_MM_Var( FT_Face face, michael@0: FT_MM_Var* *amaster ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Set_MM_Design_Coordinates */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* For Multiple Masters fonts, choose an interpolated font design */ michael@0: /* through design coordinates. */ michael@0: /* */ michael@0: /* This function can't be used with GX fonts. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* face :: A handle to the source face. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* num_coords :: The number of design coordinates (must be equal to */ michael@0: /* the number of axes in the font). */ michael@0: /* */ michael@0: /* coords :: An array of design coordinates. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Set_MM_Design_Coordinates( FT_Face face, michael@0: FT_UInt num_coords, michael@0: FT_Long* coords ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Set_Var_Design_Coordinates */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* For Multiple Master or GX Var fonts, choose an interpolated font */ michael@0: /* design through design coordinates. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* face :: A handle to the source face. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* num_coords :: The number of design coordinates (must be equal to */ michael@0: /* the number of axes in the font). */ michael@0: /* */ michael@0: /* coords :: An array of design coordinates. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Set_Var_Design_Coordinates( FT_Face face, michael@0: FT_UInt num_coords, michael@0: FT_Fixed* coords ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Set_MM_Blend_Coordinates */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* For Multiple Masters and GX var fonts, choose an interpolated font */ michael@0: /* design through normalized blend coordinates. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* face :: A handle to the source face. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* num_coords :: The number of design coordinates (must be equal to */ michael@0: /* the number of axes in the font). */ michael@0: /* */ michael@0: /* coords :: The design coordinates array (each element must be */ michael@0: /* between 0 and 1.0). */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Set_MM_Blend_Coordinates( FT_Face face, michael@0: FT_UInt num_coords, michael@0: FT_Fixed* coords ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Set_Var_Blend_Coordinates */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This is another name of @FT_Set_MM_Blend_Coordinates. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Set_Var_Blend_Coordinates( FT_Face face, michael@0: FT_UInt num_coords, michael@0: FT_Fixed* coords ); michael@0: michael@0: michael@0: /* */ michael@0: michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __FTMM_H__ */ michael@0: michael@0: michael@0: /* END */