modules/freetype2/include/ftmm.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /***************************************************************************/
michael@0 2 /* */
michael@0 3 /* ftmm.h */
michael@0 4 /* */
michael@0 5 /* FreeType Multiple Master font interface (specification). */
michael@0 6 /* */
michael@0 7 /* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 by */
michael@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
michael@0 9 /* */
michael@0 10 /* This file is part of the FreeType project, and may only be used, */
michael@0 11 /* modified, and distributed under the terms of the FreeType project */
michael@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
michael@0 13 /* this file you indicate that you have read the license and */
michael@0 14 /* understand and accept it fully. */
michael@0 15 /* */
michael@0 16 /***************************************************************************/
michael@0 17
michael@0 18
michael@0 19 #ifndef __FTMM_H__
michael@0 20 #define __FTMM_H__
michael@0 21
michael@0 22
michael@0 23 #include <ft2build.h>
michael@0 24 #include FT_TYPE1_TABLES_H
michael@0 25
michael@0 26
michael@0 27 FT_BEGIN_HEADER
michael@0 28
michael@0 29
michael@0 30 /*************************************************************************/
michael@0 31 /* */
michael@0 32 /* <Section> */
michael@0 33 /* multiple_masters */
michael@0 34 /* */
michael@0 35 /* <Title> */
michael@0 36 /* Multiple Masters */
michael@0 37 /* */
michael@0 38 /* <Abstract> */
michael@0 39 /* How to manage Multiple Masters fonts. */
michael@0 40 /* */
michael@0 41 /* <Description> */
michael@0 42 /* The following types and functions are used to manage Multiple */
michael@0 43 /* Master fonts, i.e., the selection of specific design instances by */
michael@0 44 /* setting design axis coordinates. */
michael@0 45 /* */
michael@0 46 /* George Williams has extended this interface to make it work with */
michael@0 47 /* both Type~1 Multiple Masters fonts and GX distortable (var) */
michael@0 48 /* fonts. Some of these routines only work with MM fonts, others */
michael@0 49 /* will work with both types. They are similar enough that a */
michael@0 50 /* consistent interface makes sense. */
michael@0 51 /* */
michael@0 52 /*************************************************************************/
michael@0 53
michael@0 54
michael@0 55 /*************************************************************************/
michael@0 56 /* */
michael@0 57 /* <Struct> */
michael@0 58 /* FT_MM_Axis */
michael@0 59 /* */
michael@0 60 /* <Description> */
michael@0 61 /* A simple structure used to model a given axis in design space for */
michael@0 62 /* Multiple Masters fonts. */
michael@0 63 /* */
michael@0 64 /* This structure can't be used for GX var fonts. */
michael@0 65 /* */
michael@0 66 /* <Fields> */
michael@0 67 /* name :: The axis's name. */
michael@0 68 /* */
michael@0 69 /* minimum :: The axis's minimum design coordinate. */
michael@0 70 /* */
michael@0 71 /* maximum :: The axis's maximum design coordinate. */
michael@0 72 /* */
michael@0 73 typedef struct FT_MM_Axis_
michael@0 74 {
michael@0 75 FT_String* name;
michael@0 76 FT_Long minimum;
michael@0 77 FT_Long maximum;
michael@0 78
michael@0 79 } FT_MM_Axis;
michael@0 80
michael@0 81
michael@0 82 /*************************************************************************/
michael@0 83 /* */
michael@0 84 /* <Struct> */
michael@0 85 /* FT_Multi_Master */
michael@0 86 /* */
michael@0 87 /* <Description> */
michael@0 88 /* A structure used to model the axes and space of a Multiple Masters */
michael@0 89 /* font. */
michael@0 90 /* */
michael@0 91 /* This structure can't be used for GX var fonts. */
michael@0 92 /* */
michael@0 93 /* <Fields> */
michael@0 94 /* num_axis :: Number of axes. Cannot exceed~4. */
michael@0 95 /* */
michael@0 96 /* num_designs :: Number of designs; should be normally 2^num_axis */
michael@0 97 /* even though the Type~1 specification strangely */
michael@0 98 /* allows for intermediate designs to be present. This */
michael@0 99 /* number cannot exceed~16. */
michael@0 100 /* */
michael@0 101 /* axis :: A table of axis descriptors. */
michael@0 102 /* */
michael@0 103 typedef struct FT_Multi_Master_
michael@0 104 {
michael@0 105 FT_UInt num_axis;
michael@0 106 FT_UInt num_designs;
michael@0 107 FT_MM_Axis axis[T1_MAX_MM_AXIS];
michael@0 108
michael@0 109 } FT_Multi_Master;
michael@0 110
michael@0 111
michael@0 112 /*************************************************************************/
michael@0 113 /* */
michael@0 114 /* <Struct> */
michael@0 115 /* FT_Var_Axis */
michael@0 116 /* */
michael@0 117 /* <Description> */
michael@0 118 /* A simple structure used to model a given axis in design space for */
michael@0 119 /* Multiple Masters and GX var fonts. */
michael@0 120 /* */
michael@0 121 /* <Fields> */
michael@0 122 /* name :: The axis's name. */
michael@0 123 /* Not always meaningful for GX. */
michael@0 124 /* */
michael@0 125 /* minimum :: The axis's minimum design coordinate. */
michael@0 126 /* */
michael@0 127 /* def :: The axis's default design coordinate. */
michael@0 128 /* FreeType computes meaningful default values for MM; it */
michael@0 129 /* is then an integer value, not in 16.16 format. */
michael@0 130 /* */
michael@0 131 /* maximum :: The axis's maximum design coordinate. */
michael@0 132 /* */
michael@0 133 /* tag :: The axis's tag (the GX equivalent to `name'). */
michael@0 134 /* FreeType provides default values for MM if possible. */
michael@0 135 /* */
michael@0 136 /* strid :: The entry in `name' table (another GX version of */
michael@0 137 /* `name'). */
michael@0 138 /* Not meaningful for MM. */
michael@0 139 /* */
michael@0 140 typedef struct FT_Var_Axis_
michael@0 141 {
michael@0 142 FT_String* name;
michael@0 143
michael@0 144 FT_Fixed minimum;
michael@0 145 FT_Fixed def;
michael@0 146 FT_Fixed maximum;
michael@0 147
michael@0 148 FT_ULong tag;
michael@0 149 FT_UInt strid;
michael@0 150
michael@0 151 } FT_Var_Axis;
michael@0 152
michael@0 153
michael@0 154 /*************************************************************************/
michael@0 155 /* */
michael@0 156 /* <Struct> */
michael@0 157 /* FT_Var_Named_Style */
michael@0 158 /* */
michael@0 159 /* <Description> */
michael@0 160 /* A simple structure used to model a named style in a GX var font. */
michael@0 161 /* */
michael@0 162 /* This structure can't be used for MM fonts. */
michael@0 163 /* */
michael@0 164 /* <Fields> */
michael@0 165 /* coords :: The design coordinates for this style. */
michael@0 166 /* This is an array with one entry for each axis. */
michael@0 167 /* */
michael@0 168 /* strid :: The entry in `name' table identifying this style. */
michael@0 169 /* */
michael@0 170 typedef struct FT_Var_Named_Style_
michael@0 171 {
michael@0 172 FT_Fixed* coords;
michael@0 173 FT_UInt strid;
michael@0 174
michael@0 175 } FT_Var_Named_Style;
michael@0 176
michael@0 177
michael@0 178 /*************************************************************************/
michael@0 179 /* */
michael@0 180 /* <Struct> */
michael@0 181 /* FT_MM_Var */
michael@0 182 /* */
michael@0 183 /* <Description> */
michael@0 184 /* A structure used to model the axes and space of a Multiple Masters */
michael@0 185 /* or GX var distortable font. */
michael@0 186 /* */
michael@0 187 /* Some fields are specific to one format and not to the other. */
michael@0 188 /* */
michael@0 189 /* <Fields> */
michael@0 190 /* num_axis :: The number of axes. The maximum value is~4 for */
michael@0 191 /* MM; no limit in GX. */
michael@0 192 /* */
michael@0 193 /* num_designs :: The number of designs; should be normally */
michael@0 194 /* 2^num_axis for MM fonts. Not meaningful for GX */
michael@0 195 /* (where every glyph could have a different */
michael@0 196 /* number of designs). */
michael@0 197 /* */
michael@0 198 /* num_namedstyles :: The number of named styles; only meaningful for */
michael@0 199 /* GX that allows certain design coordinates to */
michael@0 200 /* have a string ID (in the `name' table) */
michael@0 201 /* associated with them. The font can tell the */
michael@0 202 /* user that, for example, Weight=1.5 is `Bold'. */
michael@0 203 /* */
michael@0 204 /* axis :: A table of axis descriptors. */
michael@0 205 /* GX fonts contain slightly more data than MM. */
michael@0 206 /* */
michael@0 207 /* namedstyles :: A table of named styles. */
michael@0 208 /* Only meaningful with GX. */
michael@0 209 /* */
michael@0 210 typedef struct FT_MM_Var_
michael@0 211 {
michael@0 212 FT_UInt num_axis;
michael@0 213 FT_UInt num_designs;
michael@0 214 FT_UInt num_namedstyles;
michael@0 215 FT_Var_Axis* axis;
michael@0 216 FT_Var_Named_Style* namedstyle;
michael@0 217
michael@0 218 } FT_MM_Var;
michael@0 219
michael@0 220
michael@0 221 /* */
michael@0 222
michael@0 223
michael@0 224 /*************************************************************************/
michael@0 225 /* */
michael@0 226 /* <Function> */
michael@0 227 /* FT_Get_Multi_Master */
michael@0 228 /* */
michael@0 229 /* <Description> */
michael@0 230 /* Retrieve the Multiple Master descriptor of a given font. */
michael@0 231 /* */
michael@0 232 /* This function can't be used with GX fonts. */
michael@0 233 /* */
michael@0 234 /* <Input> */
michael@0 235 /* face :: A handle to the source face. */
michael@0 236 /* */
michael@0 237 /* <Output> */
michael@0 238 /* amaster :: The Multiple Masters descriptor. */
michael@0 239 /* */
michael@0 240 /* <Return> */
michael@0 241 /* FreeType error code. 0~means success. */
michael@0 242 /* */
michael@0 243 FT_EXPORT( FT_Error )
michael@0 244 FT_Get_Multi_Master( FT_Face face,
michael@0 245 FT_Multi_Master *amaster );
michael@0 246
michael@0 247
michael@0 248 /*************************************************************************/
michael@0 249 /* */
michael@0 250 /* <Function> */
michael@0 251 /* FT_Get_MM_Var */
michael@0 252 /* */
michael@0 253 /* <Description> */
michael@0 254 /* Retrieve the Multiple Master/GX var descriptor of a given font. */
michael@0 255 /* */
michael@0 256 /* <Input> */
michael@0 257 /* face :: A handle to the source face. */
michael@0 258 /* */
michael@0 259 /* <Output> */
michael@0 260 /* amaster :: The Multiple Masters/GX var descriptor. */
michael@0 261 /* Allocates a data structure, which the user must free. */
michael@0 262 /* */
michael@0 263 /* <Return> */
michael@0 264 /* FreeType error code. 0~means success. */
michael@0 265 /* */
michael@0 266 FT_EXPORT( FT_Error )
michael@0 267 FT_Get_MM_Var( FT_Face face,
michael@0 268 FT_MM_Var* *amaster );
michael@0 269
michael@0 270
michael@0 271 /*************************************************************************/
michael@0 272 /* */
michael@0 273 /* <Function> */
michael@0 274 /* FT_Set_MM_Design_Coordinates */
michael@0 275 /* */
michael@0 276 /* <Description> */
michael@0 277 /* For Multiple Masters fonts, choose an interpolated font design */
michael@0 278 /* through design coordinates. */
michael@0 279 /* */
michael@0 280 /* This function can't be used with GX fonts. */
michael@0 281 /* */
michael@0 282 /* <InOut> */
michael@0 283 /* face :: A handle to the source face. */
michael@0 284 /* */
michael@0 285 /* <Input> */
michael@0 286 /* num_coords :: The number of design coordinates (must be equal to */
michael@0 287 /* the number of axes in the font). */
michael@0 288 /* */
michael@0 289 /* coords :: An array of design coordinates. */
michael@0 290 /* */
michael@0 291 /* <Return> */
michael@0 292 /* FreeType error code. 0~means success. */
michael@0 293 /* */
michael@0 294 FT_EXPORT( FT_Error )
michael@0 295 FT_Set_MM_Design_Coordinates( FT_Face face,
michael@0 296 FT_UInt num_coords,
michael@0 297 FT_Long* coords );
michael@0 298
michael@0 299
michael@0 300 /*************************************************************************/
michael@0 301 /* */
michael@0 302 /* <Function> */
michael@0 303 /* FT_Set_Var_Design_Coordinates */
michael@0 304 /* */
michael@0 305 /* <Description> */
michael@0 306 /* For Multiple Master or GX Var fonts, choose an interpolated font */
michael@0 307 /* design through design coordinates. */
michael@0 308 /* */
michael@0 309 /* <InOut> */
michael@0 310 /* face :: A handle to the source face. */
michael@0 311 /* */
michael@0 312 /* <Input> */
michael@0 313 /* num_coords :: The number of design coordinates (must be equal to */
michael@0 314 /* the number of axes in the font). */
michael@0 315 /* */
michael@0 316 /* coords :: An array of design coordinates. */
michael@0 317 /* */
michael@0 318 /* <Return> */
michael@0 319 /* FreeType error code. 0~means success. */
michael@0 320 /* */
michael@0 321 FT_EXPORT( FT_Error )
michael@0 322 FT_Set_Var_Design_Coordinates( FT_Face face,
michael@0 323 FT_UInt num_coords,
michael@0 324 FT_Fixed* coords );
michael@0 325
michael@0 326
michael@0 327 /*************************************************************************/
michael@0 328 /* */
michael@0 329 /* <Function> */
michael@0 330 /* FT_Set_MM_Blend_Coordinates */
michael@0 331 /* */
michael@0 332 /* <Description> */
michael@0 333 /* For Multiple Masters and GX var fonts, choose an interpolated font */
michael@0 334 /* design through normalized blend coordinates. */
michael@0 335 /* */
michael@0 336 /* <InOut> */
michael@0 337 /* face :: A handle to the source face. */
michael@0 338 /* */
michael@0 339 /* <Input> */
michael@0 340 /* num_coords :: The number of design coordinates (must be equal to */
michael@0 341 /* the number of axes in the font). */
michael@0 342 /* */
michael@0 343 /* coords :: The design coordinates array (each element must be */
michael@0 344 /* between 0 and 1.0). */
michael@0 345 /* */
michael@0 346 /* <Return> */
michael@0 347 /* FreeType error code. 0~means success. */
michael@0 348 /* */
michael@0 349 FT_EXPORT( FT_Error )
michael@0 350 FT_Set_MM_Blend_Coordinates( FT_Face face,
michael@0 351 FT_UInt num_coords,
michael@0 352 FT_Fixed* coords );
michael@0 353
michael@0 354
michael@0 355 /*************************************************************************/
michael@0 356 /* */
michael@0 357 /* <Function> */
michael@0 358 /* FT_Set_Var_Blend_Coordinates */
michael@0 359 /* */
michael@0 360 /* <Description> */
michael@0 361 /* This is another name of @FT_Set_MM_Blend_Coordinates. */
michael@0 362 /* */
michael@0 363 FT_EXPORT( FT_Error )
michael@0 364 FT_Set_Var_Blend_Coordinates( FT_Face face,
michael@0 365 FT_UInt num_coords,
michael@0 366 FT_Fixed* coords );
michael@0 367
michael@0 368
michael@0 369 /* */
michael@0 370
michael@0 371
michael@0 372 FT_END_HEADER
michael@0 373
michael@0 374 #endif /* __FTMM_H__ */
michael@0 375
michael@0 376
michael@0 377 /* END */

mercurial