1 /***************************************************************************/ 2 /* */ 3 /* freetype.h */ 4 /* */ 5 /* FreeType high-level API and common types (specification only). */ 6 /* */ 7 /* Copyright 1996-2013 by */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 /* */ 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. */ 15 /* */ 16 /***************************************************************************/ 17 18 19 #ifndef __FREETYPE_H__ 20 #define __FREETYPE_H__ 21 22 23 #ifndef FT_FREETYPE_H 24 #error "`ft2build.h' hasn't been included yet!" 25 #error "Please always use macros to include FreeType header files." 26 #error "Example:" 27 #error " #include <ft2build.h>" 28 #error " #include FT_FREETYPE_H" 29 #endif 30 31 32 #include <ft2build.h> 33 #include FT_CONFIG_CONFIG_H 34 #include FT_TYPES_H 35 #include FT_ERRORS_H 36 37 38 FT_BEGIN_HEADER 39 40 41 42 /*************************************************************************/ 43 /* */ 44 /* <Section> */ 45 /* user_allocation */ 46 /* */ 47 /* <Title> */ 48 /* User allocation */ 49 /* */ 50 /* <Abstract> */ 51 /* How client applications should allocate FreeType data structures. */ 52 /* */ 53 /* <Description> */ 54 /* FreeType assumes that structures allocated by the user and passed */ 55 /* as arguments are zeroed out except for the actual data. In other */ 56 /* words, it is recommended to use `calloc' (or variants of it) */ 57 /* instead of `malloc' for allocation. */ 58 /* */ 59 /*************************************************************************/ 60 61 62 63 /*************************************************************************/ 64 /*************************************************************************/ 65 /* */ 66 /* B A S I C T Y P E S */ 67 /* */ 68 /*************************************************************************/ 69 /*************************************************************************/ 70 71 72 /*************************************************************************/ 73 /* */ 74 /* <Section> */ 75 /* base_interface */ 76 /* */ 77 /* <Title> */ 78 /* Base Interface */ 79 /* */ 80 /* <Abstract> */ 81 /* The FreeType~2 base font interface. */ 82 /* */ 83 /* <Description> */ 84 /* This section describes the public high-level API of FreeType~2. */ 85 /* */ 86 /* <Order> */ 87 /* FT_Library */ 88 /* FT_Face */ 89 /* FT_Size */ 90 /* FT_GlyphSlot */ 91 /* FT_CharMap */ 92 /* FT_Encoding */ 93 /* */ 94 /* FT_FaceRec */ 95 /* */ 96 /* FT_FACE_FLAG_SCALABLE */ 97 /* FT_FACE_FLAG_FIXED_SIZES */ 98 /* FT_FACE_FLAG_FIXED_WIDTH */ 99 /* FT_FACE_FLAG_HORIZONTAL */ 100 /* FT_FACE_FLAG_VERTICAL */ 101 /* FT_FACE_FLAG_COLOR */ 102 /* FT_FACE_FLAG_SFNT */ 103 /* FT_FACE_FLAG_CID_KEYED */ 104 /* FT_FACE_FLAG_TRICKY */ 105 /* FT_FACE_FLAG_KERNING */ 106 /* FT_FACE_FLAG_MULTIPLE_MASTERS */ 107 /* FT_FACE_FLAG_GLYPH_NAMES */ 108 /* FT_FACE_FLAG_EXTERNAL_STREAM */ 109 /* FT_FACE_FLAG_FAST_GLYPHS */ 110 /* FT_FACE_FLAG_HINTER */ 111 /* */ 112 /* FT_STYLE_FLAG_BOLD */ 113 /* FT_STYLE_FLAG_ITALIC */ 114 /* */ 115 /* FT_SizeRec */ 116 /* FT_Size_Metrics */ 117 /* */ 118 /* FT_GlyphSlotRec */ 119 /* FT_Glyph_Metrics */ 120 /* FT_SubGlyph */ 121 /* */ 122 /* FT_Bitmap_Size */ 123 /* */ 124 /* FT_Init_FreeType */ 125 /* FT_Done_FreeType */ 126 /* */ 127 /* FT_New_Face */ 128 /* FT_Done_Face */ 129 /* FT_New_Memory_Face */ 130 /* FT_Open_Face */ 131 /* FT_Open_Args */ 132 /* FT_Parameter */ 133 /* FT_Attach_File */ 134 /* FT_Attach_Stream */ 135 /* */ 136 /* FT_Set_Char_Size */ 137 /* FT_Set_Pixel_Sizes */ 138 /* FT_Request_Size */ 139 /* FT_Select_Size */ 140 /* FT_Size_Request_Type */ 141 /* FT_Size_Request */ 142 /* FT_Set_Transform */ 143 /* FT_Load_Glyph */ 144 /* FT_Get_Char_Index */ 145 /* FT_Get_Name_Index */ 146 /* FT_Load_Char */ 147 /* */ 148 /* FT_OPEN_MEMORY */ 149 /* FT_OPEN_STREAM */ 150 /* FT_OPEN_PATHNAME */ 151 /* FT_OPEN_DRIVER */ 152 /* FT_OPEN_PARAMS */ 153 /* */ 154 /* FT_LOAD_DEFAULT */ 155 /* FT_LOAD_RENDER */ 156 /* FT_LOAD_MONOCHROME */ 157 /* FT_LOAD_LINEAR_DESIGN */ 158 /* FT_LOAD_NO_SCALE */ 159 /* FT_LOAD_NO_HINTING */ 160 /* FT_LOAD_NO_BITMAP */ 161 /* FT_LOAD_CROP_BITMAP */ 162 /* */ 163 /* FT_LOAD_VERTICAL_LAYOUT */ 164 /* FT_LOAD_IGNORE_TRANSFORM */ 165 /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ 166 /* FT_LOAD_FORCE_AUTOHINT */ 167 /* FT_LOAD_NO_RECURSE */ 168 /* FT_LOAD_PEDANTIC */ 169 /* */ 170 /* FT_LOAD_TARGET_NORMAL */ 171 /* FT_LOAD_TARGET_LIGHT */ 172 /* FT_LOAD_TARGET_MONO */ 173 /* FT_LOAD_TARGET_LCD */ 174 /* FT_LOAD_TARGET_LCD_V */ 175 /* */ 176 /* FT_Render_Glyph */ 177 /* FT_Render_Mode */ 178 /* FT_Get_Kerning */ 179 /* FT_Kerning_Mode */ 180 /* FT_Get_Track_Kerning */ 181 /* FT_Get_Glyph_Name */ 182 /* FT_Get_Postscript_Name */ 183 /* */ 184 /* FT_CharMapRec */ 185 /* FT_Select_Charmap */ 186 /* FT_Set_Charmap */ 187 /* FT_Get_Charmap_Index */ 188 /* */ 189 /* FT_FSTYPE_INSTALLABLE_EMBEDDING */ 190 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */ 191 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */ 192 /* FT_FSTYPE_EDITABLE_EMBEDDING */ 193 /* FT_FSTYPE_NO_SUBSETTING */ 194 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */ 195 /* */ 196 /* FT_Get_FSType_Flags */ 197 /* */ 198 /*************************************************************************/ 199 200 201 /*************************************************************************/ 202 /* */ 203 /* <Struct> */ 204 /* FT_Glyph_Metrics */ 205 /* */ 206 /* <Description> */ 207 /* A structure used to model the metrics of a single glyph. The */ 208 /* values are expressed in 26.6 fractional pixel format; if the flag */ 209 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ 210 /* are expressed in font units instead. */ 211 /* */ 212 /* <Fields> */ 213 /* width :: */ 214 /* The glyph's width. */ 215 /* */ 216 /* height :: */ 217 /* The glyph's height. */ 218 /* */ 219 /* horiBearingX :: */ 220 /* Left side bearing for horizontal layout. */ 221 /* */ 222 /* horiBearingY :: */ 223 /* Top side bearing for horizontal layout. */ 224 /* */ 225 /* horiAdvance :: */ 226 /* Advance width for horizontal layout. */ 227 /* */ 228 /* vertBearingX :: */ 229 /* Left side bearing for vertical layout. */ 230 /* */ 231 /* vertBearingY :: */ 232 /* Top side bearing for vertical layout. Larger positive values */ 233 /* mean further below the vertical glyph origin. */ 234 /* */ 235 /* vertAdvance :: */ 236 /* Advance height for vertical layout. Positive values mean the */ 237 /* glyph has a positive advance downward. */ 238 /* */ 239 /* <Note> */ 240 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ 241 /* dimensions of the hinted glyph (in case hinting is applicable). */ 242 /* */ 243 /* Stroking a glyph with an outside border does not increase */ 244 /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ 245 /* values to account for the added width and height. */ 246 /* */ 247 typedef struct FT_Glyph_Metrics_ 248 { 249 FT_Pos width; 250 FT_Pos height; 251 252 FT_Pos horiBearingX; 253 FT_Pos horiBearingY; 254 FT_Pos horiAdvance; 255 256 FT_Pos vertBearingX; 257 FT_Pos vertBearingY; 258 FT_Pos vertAdvance; 259 260 } FT_Glyph_Metrics; 261 262 263 /*************************************************************************/ 264 /* */ 265 /* <Struct> */ 266 /* FT_Bitmap_Size */ 267 /* */ 268 /* <Description> */ 269 /* This structure models the metrics of a bitmap strike (i.e., a set */ 270 /* of glyphs for a given point size and resolution) in a bitmap font. */ 271 /* It is used for the `available_sizes' field of @FT_Face. */ 272 /* */ 273 /* <Fields> */ 274 /* height :: The vertical distance, in pixels, between two */ 275 /* consecutive baselines. It is always positive. */ 276 /* */ 277 /* width :: The average width, in pixels, of all glyphs in the */ 278 /* strike. */ 279 /* */ 280 /* size :: The nominal size of the strike in 26.6 fractional */ 281 /* points. This field is not very useful. */ 282 /* */ 283 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ 284 /* pixels. */ 285 /* */ 286 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ 287 /* pixels. */ 288 /* */ 289 /* <Note> */ 290 /* Windows FNT: */ 291 /* The nominal size given in a FNT font is not reliable. Thus when */ 292 /* the driver finds it incorrect, it sets `size' to some calculated */ 293 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */ 294 /* height given in the font, respectively. */ 295 /* */ 296 /* TrueType embedded bitmaps: */ 297 /* `size', `width', and `height' values are not contained in the */ 298 /* bitmap strike itself. They are computed from the global font */ 299 /* parameters. */ 300 /* */ 301 typedef struct FT_Bitmap_Size_ 302 { 303 FT_Short height; 304 FT_Short width; 305 306 FT_Pos size; 307 308 FT_Pos x_ppem; 309 FT_Pos y_ppem; 310 311 } FT_Bitmap_Size; 312 313 314 /*************************************************************************/ 315 /*************************************************************************/ 316 /* */ 317 /* O B J E C T C L A S S E S */ 318 /* */ 319 /*************************************************************************/ 320 /*************************************************************************/ 321 322 /*************************************************************************/ 323 /* */ 324 /* <Type> */ 325 /* FT_Library */ 326 /* */ 327 /* <Description> */ 328 /* A handle to a FreeType library instance. Each `library' is */ 329 /* completely independent from the others; it is the `root' of a set */ 330 /* of objects like fonts, faces, sizes, etc. */ 331 /* */ 332 /* It also embeds a memory manager (see @FT_Memory), as well as a */ 333 /* scan-line converter object (see @FT_Raster). */ 334 /* */ 335 /* In multi-threaded applications, make sure that the same FT_Library */ 336 /* object or any of its children doesn't get accessed in parallel. */ 337 /* */ 338 /* <Note> */ 339 /* Library objects are normally created by @FT_Init_FreeType, and */ 340 /* destroyed with @FT_Done_FreeType. If you need reference-counting */ 341 /* (cf. @FT_Reference_Library), use @FT_New_Library and */ 342 /* @FT_Done_Library. */ 343 /* */ 344 typedef struct FT_LibraryRec_ *FT_Library; 345 346 347 /*************************************************************************/ 348 /* */ 349 /* <Type> */ 350 /* FT_Module */ 351 /* */ 352 /* <Description> */ 353 /* A handle to a given FreeType module object. Each module can be a */ 354 /* font driver, a renderer, or anything else that provides services */ 355 /* to the formers. */ 356 /* */ 357 typedef struct FT_ModuleRec_* FT_Module; 358 359 360 /*************************************************************************/ 361 /* */ 362 /* <Type> */ 363 /* FT_Driver */ 364 /* */ 365 /* <Description> */ 366 /* A handle to a given FreeType font driver object. Each font driver */ 367 /* is a special module capable of creating faces from font files. */ 368 /* */ 369 typedef struct FT_DriverRec_* FT_Driver; 370 371 372 /*************************************************************************/ 373 /* */ 374 /* <Type> */ 375 /* FT_Renderer */ 376 /* */ 377 /* <Description> */ 378 /* A handle to a given FreeType renderer. A renderer is a special */ 379 /* module in charge of converting a glyph image to a bitmap, when */ 380 /* necessary. Each renderer supports a given glyph image format, and */ 381 /* one or more target surface depths. */ 382 /* */ 383 typedef struct FT_RendererRec_* FT_Renderer; 384 385 386 /*************************************************************************/ 387 /* */ 388 /* <Type> */ 389 /* FT_Face */ 390 /* */ 391 /* <Description> */ 392 /* A handle to a given typographic face object. A face object models */ 393 /* a given typeface, in a given style. */ 394 /* */ 395 /* <Note> */ 396 /* Each face object also owns a single @FT_GlyphSlot object, as well */ 397 /* as one or more @FT_Size objects. */ 398 /* */ 399 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ 400 /* a given filepathname or a custom input stream. */ 401 /* */ 402 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ 403 /* */ 404 /* <Also> */ 405 /* See @FT_FaceRec for the publicly accessible fields of a given face */ 406 /* object. */ 407 /* */ 408 typedef struct FT_FaceRec_* FT_Face; 409 410 411 /*************************************************************************/ 412 /* */ 413 /* <Type> */ 414 /* FT_Size */ 415 /* */ 416 /* <Description> */ 417 /* A handle to an object used to model a face scaled to a given */ 418 /* character size. */ 419 /* */ 420 /* <Note> */ 421 /* Each @FT_Face has an _active_ @FT_Size object that is used by */ 422 /* functions like @FT_Load_Glyph to determine the scaling */ 423 /* transformation that in turn is used to load and hint glyphs and */ 424 /* metrics. */ 425 /* */ 426 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ 427 /* @FT_Request_Size or even @FT_Select_Size to change the content */ 428 /* (i.e., the scaling values) of the active @FT_Size. */ 429 /* */ 430 /* You can use @FT_New_Size to create additional size objects for a */ 431 /* given @FT_Face, but they won't be used by other functions until */ 432 /* you activate it through @FT_Activate_Size. Only one size can be */ 433 /* activated at any given time per face. */ 434 /* */ 435 /* <Also> */ 436 /* See @FT_SizeRec for the publicly accessible fields of a given size */ 437 /* object. */ 438 /* */ 439 typedef struct FT_SizeRec_* FT_Size; 440 441 442 /*************************************************************************/ 443 /* */ 444 /* <Type> */ 445 /* FT_GlyphSlot */ 446 /* */ 447 /* <Description> */ 448 /* A handle to a given `glyph slot'. A slot is a container where it */ 449 /* is possible to load any of the glyphs contained in its parent */ 450 /* face. */ 451 /* */ 452 /* In other words, each time you call @FT_Load_Glyph or */ 453 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ 454 /* i.e., the glyph's metrics, its image (bitmap or outline), and */ 455 /* other control information. */ 456 /* */ 457 /* <Also> */ 458 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ 459 /* */ 460 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; 461 462 463 /*************************************************************************/ 464 /* */ 465 /* <Type> */ 466 /* FT_CharMap */ 467 /* */ 468 /* <Description> */ 469 /* A handle to a given character map. A charmap is used to translate */ 470 /* character codes in a given encoding into glyph indexes for its */ 471 /* parent's face. Some font formats may provide several charmaps per */ 472 /* font. */ 473 /* */ 474 /* Each face object owns zero or more charmaps, but only one of them */ 475 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */ 476 /* */ 477 /* The list of available charmaps in a face is available through the */ 478 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ 479 /* */ 480 /* The currently active charmap is available as `face->charmap'. */ 481 /* You should call @FT_Set_Charmap to change it. */ 482 /* */ 483 /* <Note> */ 484 /* When a new face is created (either through @FT_New_Face or */ 485 /* @FT_Open_Face), the library looks for a Unicode charmap within */ 486 /* the list and automatically activates it. */ 487 /* */ 488 /* <Also> */ 489 /* See @FT_CharMapRec for the publicly accessible fields of a given */ 490 /* character map. */ 491 /* */ 492 typedef struct FT_CharMapRec_* FT_CharMap; 493 494 495 /*************************************************************************/ 496 /* */ 497 /* <Macro> */ 498 /* FT_ENC_TAG */ 499 /* */ 500 /* <Description> */ 501 /* This macro converts four-letter tags into an unsigned long. It is */ 502 /* used to define `encoding' identifiers (see @FT_Encoding). */ 503 /* */ 504 /* <Note> */ 505 /* Since many 16-bit compilers don't like 32-bit enumerations, you */ 506 /* should redefine this macro in case of problems to something like */ 507 /* this: */ 508 /* */ 509 /* { */ 510 /* #define FT_ENC_TAG( value, a, b, c, d ) value */ 511 /* } */ 512 /* */ 513 /* to get a simple enumeration without assigning special numbers. */ 514 /* */ 515 516 #ifndef FT_ENC_TAG 517 #define FT_ENC_TAG( value, a, b, c, d ) \ 518 value = ( ( (FT_UInt32)(a) << 24 ) | \ 519 ( (FT_UInt32)(b) << 16 ) | \ 520 ( (FT_UInt32)(c) << 8 ) | \ 521 (FT_UInt32)(d) ) 522 523 #endif /* FT_ENC_TAG */ 524 525 526 /*************************************************************************/ 527 /* */ 528 /* <Enum> */ 529 /* FT_Encoding */ 530 /* */ 531 /* <Description> */ 532 /* An enumeration used to specify character sets supported by */ 533 /* charmaps. Used in the @FT_Select_Charmap API function. */ 534 /* */ 535 /* <Note> */ 536 /* Despite the name, this enumeration lists specific character */ 537 /* repertories (i.e., charsets), and not text encoding methods (e.g., */ 538 /* UTF-8, UTF-16, etc.). */ 539 /* */ 540 /* Other encodings might be defined in the future. */ 541 /* */ 542 /* <Values> */ 543 /* FT_ENCODING_NONE :: */ 544 /* The encoding value~0 is reserved. */ 545 /* */ 546 /* FT_ENCODING_UNICODE :: */ 547 /* Corresponds to the Unicode character set. This value covers */ 548 /* all versions of the Unicode repertoire, including ASCII and */ 549 /* Latin-1. Most fonts include a Unicode charmap, but not all */ 550 /* of them. */ 551 /* */ 552 /* For example, if you want to access Unicode value U+1F028 (and */ 553 /* the font contains it), use value 0x1F028 as the input value for */ 554 /* @FT_Get_Char_Index. */ 555 /* */ 556 /* FT_ENCODING_MS_SYMBOL :: */ 557 /* Corresponds to the Microsoft Symbol encoding, used to encode */ 558 /* mathematical symbols in the 32..255 character code range. For */ 559 /* more information, see */ 560 /* `http://www.kostis.net/charsets/symbol.htm'. */ 561 /* */ 562 /* FT_ENCODING_SJIS :: */ 563 /* Corresponds to Japanese SJIS encoding. More info at */ 564 /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */ 565 /* See note on multi-byte encodings below. */ 566 /* */ 567 /* FT_ENCODING_GB2312 :: */ 568 /* Corresponds to an encoding system for Simplified Chinese as used */ 569 /* used in mainland China. */ 570 /* */ 571 /* FT_ENCODING_BIG5 :: */ 572 /* Corresponds to an encoding system for Traditional Chinese as */ 573 /* used in Taiwan and Hong Kong. */ 574 /* */ 575 /* FT_ENCODING_WANSUNG :: */ 576 /* Corresponds to the Korean encoding system known as Wansung. */ 577 /* For more information see */ 578 /* `http://msdn.microsoft.com/en-US/goglobal/cc305154'. */ 579 /* */ 580 /* FT_ENCODING_JOHAB :: */ 581 /* The Korean standard character set (KS~C 5601-1992), which */ 582 /* corresponds to MS Windows code page 1361. This character set */ 583 /* includes all possible Hangeul character combinations. */ 584 /* */ 585 /* FT_ENCODING_ADOBE_LATIN_1 :: */ 586 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */ 587 /* PostScript font. It is limited to 256 character codes. */ 588 /* */ 589 /* FT_ENCODING_ADOBE_STANDARD :: */ 590 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */ 591 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ 592 /* codes. */ 593 /* */ 594 /* FT_ENCODING_ADOBE_EXPERT :: */ 595 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */ 596 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ 597 /* codes. */ 598 /* */ 599 /* FT_ENCODING_ADOBE_CUSTOM :: */ 600 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */ 601 /* OpenType/CFF fonts. It is limited to 256 character codes. */ 602 /* */ 603 /* FT_ENCODING_APPLE_ROMAN :: */ 604 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */ 605 /* and OpenType fonts contain a charmap for this encoding, since */ 606 /* older versions of Mac OS are able to use it. */ 607 /* */ 608 /* FT_ENCODING_OLD_LATIN_2 :: */ 609 /* This value is deprecated and was never used nor reported by */ 610 /* FreeType. Don't use or test for it. */ 611 /* */ 612 /* FT_ENCODING_MS_SJIS :: */ 613 /* Same as FT_ENCODING_SJIS. Deprecated. */ 614 /* */ 615 /* FT_ENCODING_MS_GB2312 :: */ 616 /* Same as FT_ENCODING_GB2312. Deprecated. */ 617 /* */ 618 /* FT_ENCODING_MS_BIG5 :: */ 619 /* Same as FT_ENCODING_BIG5. Deprecated. */ 620 /* */ 621 /* FT_ENCODING_MS_WANSUNG :: */ 622 /* Same as FT_ENCODING_WANSUNG. Deprecated. */ 623 /* */ 624 /* FT_ENCODING_MS_JOHAB :: */ 625 /* Same as FT_ENCODING_JOHAB. Deprecated. */ 626 /* */ 627 /* <Note> */ 628 /* By default, FreeType automatically synthesizes a Unicode charmap */ 629 /* for PostScript fonts, using their glyph names dictionaries. */ 630 /* However, it also reports the encodings defined explicitly in the */ 631 /* font file, for the cases when they are needed, with the Adobe */ 632 /* values as well. */ 633 /* */ 634 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ 635 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ 636 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ 637 /* which encoding is really present. If, for example, the */ 638 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ 639 /* the font is encoded in KOI8-R. */ 640 /* */ 641 /* FT_ENCODING_NONE is always set (with a single exception) by the */ 642 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ 643 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ 644 /* which encoding is really present. For example, */ 645 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ 646 /* Russian). */ 647 /* */ 648 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ 649 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */ 650 /* FT_ENCODING_APPLE_ROMAN). */ 651 /* */ 652 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ 653 /* @FT_Get_CMap_Language_ID to query the Mac language ID that may */ 654 /* be needed to be able to distinguish Apple encoding variants. See */ 655 /* */ 656 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */ 657 /* */ 658 /* to get an idea how to do that. Basically, if the language ID */ 659 /* is~0, don't use it, otherwise subtract 1 from the language ID. */ 660 /* Then examine `encoding_id'. If, for example, `encoding_id' is */ 661 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */ 662 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ 663 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */ 664 /* variant the Arabic encoding. */ 665 /* */ 666 typedef enum FT_Encoding_ 667 { 668 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), 669 670 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), 671 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), 672 673 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), 674 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), 675 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), 676 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), 677 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), 678 679 /* for backwards compatibility */ 680 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, 681 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, 682 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, 683 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, 684 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, 685 686 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), 687 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), 688 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), 689 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), 690 691 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), 692 693 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) 694 695 } FT_Encoding; 696 697 698 /*************************************************************************/ 699 /* */ 700 /* <Enum> */ 701 /* ft_encoding_xxx */ 702 /* */ 703 /* <Description> */ 704 /* These constants are deprecated; use the corresponding @FT_Encoding */ 705 /* values instead. */ 706 /* */ 707 #define ft_encoding_none FT_ENCODING_NONE 708 #define ft_encoding_unicode FT_ENCODING_UNICODE 709 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL 710 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 711 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 712 #define ft_encoding_sjis FT_ENCODING_SJIS 713 #define ft_encoding_gb2312 FT_ENCODING_GB2312 714 #define ft_encoding_big5 FT_ENCODING_BIG5 715 #define ft_encoding_wansung FT_ENCODING_WANSUNG 716 #define ft_encoding_johab FT_ENCODING_JOHAB 717 718 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD 719 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT 720 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM 721 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN 722 723 724 /*************************************************************************/ 725 /* */ 726 /* <Struct> */ 727 /* FT_CharMapRec */ 728 /* */ 729 /* <Description> */ 730 /* The base charmap structure. */ 731 /* */ 732 /* <Fields> */ 733 /* face :: A handle to the parent face object. */ 734 /* */ 735 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ 736 /* this with @FT_Select_Charmap. */ 737 /* */ 738 /* platform_id :: An ID number describing the platform for the */ 739 /* following encoding ID. This comes directly from */ 740 /* the TrueType specification and should be emulated */ 741 /* for other formats. */ 742 /* */ 743 /* encoding_id :: A platform specific encoding number. This also */ 744 /* comes from the TrueType specification and should be */ 745 /* emulated similarly. */ 746 /* */ 747 typedef struct FT_CharMapRec_ 748 { 749 FT_Face face; 750 FT_Encoding encoding; 751 FT_UShort platform_id; 752 FT_UShort encoding_id; 753 754 } FT_CharMapRec; 755 756 757 /*************************************************************************/ 758 /*************************************************************************/ 759 /* */ 760 /* B A S E O B J E C T C L A S S E S */ 761 /* */ 762 /*************************************************************************/ 763 /*************************************************************************/ 764 765 766 /*************************************************************************/ 767 /* */ 768 /* <Type> */ 769 /* FT_Face_Internal */ 770 /* */ 771 /* <Description> */ 772 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */ 773 /* model private data of a given @FT_Face object. */ 774 /* */ 775 /* This structure might change between releases of FreeType~2 and is */ 776 /* not generally available to client applications. */ 777 /* */ 778 typedef struct FT_Face_InternalRec_* FT_Face_Internal; 779 780 781 /*************************************************************************/ 782 /* */ 783 /* <Struct> */ 784 /* FT_FaceRec */ 785 /* */ 786 /* <Description> */ 787 /* FreeType root face class structure. A face object models a */ 788 /* typeface in a font file. */ 789 /* */ 790 /* <Fields> */ 791 /* num_faces :: The number of faces in the font file. Some */ 792 /* font formats can have multiple faces in */ 793 /* a font file. */ 794 /* */ 795 /* face_index :: The index of the face in the font file. It */ 796 /* is set to~0 if there is only one face in */ 797 /* the font file. */ 798 /* */ 799 /* face_flags :: A set of bit flags that give important */ 800 /* information about the face; see */ 801 /* @FT_FACE_FLAG_XXX for the details. */ 802 /* */ 803 /* style_flags :: A set of bit flags indicating the style of */ 804 /* the face; see @FT_STYLE_FLAG_XXX for the */ 805 /* details. */ 806 /* */ 807 /* num_glyphs :: The number of glyphs in the face. If the */ 808 /* face is scalable and has sbits (see */ 809 /* `num_fixed_sizes'), it is set to the number */ 810 /* of outline glyphs. */ 811 /* */ 812 /* For CID-keyed fonts, this value gives the */ 813 /* highest CID used in the font. */ 814 /* */ 815 /* family_name :: The face's family name. This is an ASCII */ 816 /* string, usually in English, that describes */ 817 /* the typeface's family (like `Times New */ 818 /* Roman', `Bodoni', `Garamond', etc). This */ 819 /* is a least common denominator used to list */ 820 /* fonts. Some formats (TrueType & OpenType) */ 821 /* provide localized and Unicode versions of */ 822 /* this string. Applications should use the */ 823 /* format specific interface to access them. */ 824 /* Can be NULL (e.g., in fonts embedded in a */ 825 /* PDF file). */ 826 /* */ 827 /* style_name :: The face's style name. This is an ASCII */ 828 /* string, usually in English, that describes */ 829 /* the typeface's style (like `Italic', */ 830 /* `Bold', `Condensed', etc). Not all font */ 831 /* formats provide a style name, so this field */ 832 /* is optional, and can be set to NULL. As */ 833 /* for `family_name', some formats provide */ 834 /* localized and Unicode versions of this */ 835 /* string. Applications should use the format */ 836 /* specific interface to access them. */ 837 /* */ 838 /* num_fixed_sizes :: The number of bitmap strikes in the face. */ 839 /* Even if the face is scalable, there might */ 840 /* still be bitmap strikes, which are called */ 841 /* `sbits' in that case. */ 842 /* */ 843 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ 844 /* strikes in the face. It is set to NULL if */ 845 /* there is no bitmap strike. */ 846 /* */ 847 /* num_charmaps :: The number of charmaps in the face. */ 848 /* */ 849 /* charmaps :: An array of the charmaps of the face. */ 850 /* */ 851 /* generic :: A field reserved for client uses. See the */ 852 /* @FT_Generic type description. */ 853 /* */ 854 /* bbox :: The font bounding box. Coordinates are */ 855 /* expressed in font units (see */ 856 /* `units_per_EM'). The box is large enough */ 857 /* to contain any glyph from the font. Thus, */ 858 /* `bbox.yMax' can be seen as the `maximum */ 859 /* ascender', and `bbox.yMin' as the `minimum */ 860 /* descender'. Only relevant for scalable */ 861 /* formats. */ 862 /* */ 863 /* Note that the bounding box might be off by */ 864 /* (at least) one pixel for hinted fonts. See */ 865 /* @FT_Size_Metrics for further discussion. */ 866 /* */ 867 /* units_per_EM :: The number of font units per EM square for */ 868 /* this face. This is typically 2048 for */ 869 /* TrueType fonts, and 1000 for Type~1 fonts. */ 870 /* Only relevant for scalable formats. */ 871 /* */ 872 /* ascender :: The typographic ascender of the face, */ 873 /* expressed in font units. For font formats */ 874 /* not having this information, it is set to */ 875 /* `bbox.yMax'. Only relevant for scalable */ 876 /* formats. */ 877 /* */ 878 /* descender :: The typographic descender of the face, */ 879 /* expressed in font units. For font formats */ 880 /* not having this information, it is set to */ 881 /* `bbox.yMin'. Note that this field is */ 882 /* usually negative. Only relevant for */ 883 /* scalable formats. */ 884 /* */ 885 /* height :: This value is the vertical distance */ 886 /* between two consecutive baselines, */ 887 /* expressed in font units. It is always */ 888 /* positive. Only relevant for scalable */ 889 /* formats. */ 890 /* */ 891 /* If you want the global glyph height, use */ 892 /* `ascender - descender'. */ 893 /* */ 894 /* max_advance_width :: The maximum advance width, in font units, */ 895 /* for all glyphs in this face. This can be */ 896 /* used to make word wrapping computations */ 897 /* faster. Only relevant for scalable */ 898 /* formats. */ 899 /* */ 900 /* max_advance_height :: The maximum advance height, in font units, */ 901 /* for all glyphs in this face. This is only */ 902 /* relevant for vertical layouts, and is set */ 903 /* to `height' for fonts that do not provide */ 904 /* vertical metrics. Only relevant for */ 905 /* scalable formats. */ 906 /* */ 907 /* underline_position :: The position, in font units, of the */ 908 /* underline line for this face. It is the */ 909 /* center of the underlining stem. Only */ 910 /* relevant for scalable formats. */ 911 /* */ 912 /* underline_thickness :: The thickness, in font units, of the */ 913 /* underline for this face. Only relevant for */ 914 /* scalable formats. */ 915 /* */ 916 /* glyph :: The face's associated glyph slot(s). */ 917 /* */ 918 /* size :: The current active size for this face. */ 919 /* */ 920 /* charmap :: The current active charmap for this face. */ 921 /* */ 922 /* <Note> */ 923 /* Fields may be changed after a call to @FT_Attach_File or */ 924 /* @FT_Attach_Stream. */ 925 /* */ 926 typedef struct FT_FaceRec_ 927 { 928 FT_Long num_faces; 929 FT_Long face_index; 930 931 FT_Long face_flags; 932 FT_Long style_flags; 933 934 FT_Long num_glyphs; 935 936 FT_String* family_name; 937 FT_String* style_name; 938 939 FT_Int num_fixed_sizes; 940 FT_Bitmap_Size* available_sizes; 941 942 FT_Int num_charmaps; 943 FT_CharMap* charmaps; 944 945 FT_Generic generic; 946 947 /*# The following member variables (down to `underline_thickness') */ 948 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ 949 /*# for bitmap fonts. */ 950 FT_BBox bbox; 951 952 FT_UShort units_per_EM; 953 FT_Short ascender; 954 FT_Short descender; 955 FT_Short height; 956 957 FT_Short max_advance_width; 958 FT_Short max_advance_height; 959 960 FT_Short underline_position; 961 FT_Short underline_thickness; 962 963 FT_GlyphSlot glyph; 964 FT_Size size; 965 FT_CharMap charmap; 966 967 /*@private begin */ 968 969 FT_Driver driver; 970 FT_Memory memory; 971 FT_Stream stream; 972 973 FT_ListRec sizes_list; 974 975 FT_Generic autohint; /* face-specific auto-hinter data */ 976 void* extensions; /* unused */ 977 978 FT_Face_Internal internal; 979 980 /*@private end */ 981 982 } FT_FaceRec; 983 984 985 /*************************************************************************/ 986 /* */ 987 /* <Enum> */ 988 /* FT_FACE_FLAG_XXX */ 989 /* */ 990 /* <Description> */ 991 /* A list of bit flags used in the `face_flags' field of the */ 992 /* @FT_FaceRec structure. They inform client applications of */ 993 /* properties of the corresponding face. */ 994 /* */ 995 /* <Values> */ 996 /* FT_FACE_FLAG_SCALABLE :: */ 997 /* Indicates that the face contains outline glyphs. This doesn't */ 998 /* prevent bitmap strikes, i.e., a face can have both this and */ 999 /* and @FT_FACE_FLAG_FIXED_SIZES set. */ 1000 /* */ 1001 /* FT_FACE_FLAG_FIXED_SIZES :: */ 1002 /* Indicates that the face contains bitmap strikes. See also the */ 1003 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ 1004 /* */ 1005 /* FT_FACE_FLAG_FIXED_WIDTH :: */ 1006 /* Indicates that the face contains fixed-width characters (like */ 1007 /* Courier, Lucido, MonoType, etc.). */ 1008 /* */ 1009 /* FT_FACE_FLAG_SFNT :: */ 1010 /* Indicates that the face uses the `sfnt' storage scheme. For */ 1011 /* now, this means TrueType and OpenType. */ 1012 /* */ 1013 /* FT_FACE_FLAG_HORIZONTAL :: */ 1014 /* Indicates that the face contains horizontal glyph metrics. This */ 1015 /* should be set for all common formats. */ 1016 /* */ 1017 /* FT_FACE_FLAG_VERTICAL :: */ 1018 /* Indicates that the face contains vertical glyph metrics. This */ 1019 /* is only available in some formats, not all of them. */ 1020 /* */ 1021 /* FT_FACE_FLAG_KERNING :: */ 1022 /* Indicates that the face contains kerning information. If set, */ 1023 /* the kerning distance can be retrieved through the function */ 1024 /* @FT_Get_Kerning. Otherwise the function always return the */ 1025 /* vector (0,0). Note that FreeType doesn't handle kerning data */ 1026 /* from the `GPOS' table (as present in some OpenType fonts). */ 1027 /* */ 1028 /* FT_FACE_FLAG_FAST_GLYPHS :: */ 1029 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ 1030 /* */ 1031 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ 1032 /* Indicates that the font contains multiple masters and is capable */ 1033 /* of interpolating between them. See the multiple-masters */ 1034 /* specific API for details. */ 1035 /* */ 1036 /* FT_FACE_FLAG_GLYPH_NAMES :: */ 1037 /* Indicates that the font contains glyph names that can be */ 1038 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ 1039 /* fonts contain broken glyph name tables. Use the function */ 1040 /* @FT_Has_PS_Glyph_Names when needed. */ 1041 /* */ 1042 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ 1043 /* Used internally by FreeType to indicate that a face's stream was */ 1044 /* provided by the client application and should not be destroyed */ 1045 /* when @FT_Done_Face is called. Don't read or test this flag. */ 1046 /* */ 1047 /* FT_FACE_FLAG_HINTER :: */ 1048 /* Set if the font driver has a hinting machine of its own. For */ 1049 /* example, with TrueType fonts, it makes sense to use data from */ 1050 /* the SFNT `gasp' table only if the native TrueType hinting engine */ 1051 /* (with the bytecode interpreter) is available and active. */ 1052 /* */ 1053 /* FT_FACE_FLAG_CID_KEYED :: */ 1054 /* Set if the font is CID-keyed. In that case, the font is not */ 1055 /* accessed by glyph indices but by CID values. For subsetted */ 1056 /* CID-keyed fonts this has the consequence that not all index */ 1057 /* values are a valid argument to FT_Load_Glyph. Only the CID */ 1058 /* values for which corresponding glyphs in the subsetted font */ 1059 /* exist make FT_Load_Glyph return successfully; in all other cases */ 1060 /* you get an `FT_Err_Invalid_Argument' error. */ 1061 /* */ 1062 /* Note that CID-keyed fonts that are in an SFNT wrapper don't */ 1063 /* have this flag set since the glyphs are accessed in the normal */ 1064 /* way (using contiguous indices); the `CID-ness' isn't visible to */ 1065 /* the application. */ 1066 /* */ 1067 /* FT_FACE_FLAG_TRICKY :: */ 1068 /* Set if the font is `tricky', this is, it always needs the */ 1069 /* font format's native hinting engine to get a reasonable result. */ 1070 /* A typical example is the Chinese font `mingli.ttf' that uses */ 1071 /* TrueType bytecode instructions to move and scale all of its */ 1072 /* subglyphs. */ 1073 /* */ 1074 /* It is not possible to autohint such fonts using */ 1075 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ 1076 /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ 1077 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ 1078 /* probably never want this except for demonstration purposes. */ 1079 /* */ 1080 /* Currently, there are about a dozen TrueType fonts in the list of */ 1081 /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ 1082 /* */ 1083 /* FT_FACE_FLAG_COLOR :: */ 1084 /* Set if the font has color glyph tables. To access color glyphs */ 1085 /* use @FT_LOAD_COLOR. */ 1086 /* */ 1087 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) 1088 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) 1089 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) 1090 #define FT_FACE_FLAG_SFNT ( 1L << 3 ) 1091 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) 1092 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) 1093 #define FT_FACE_FLAG_KERNING ( 1L << 6 ) 1094 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) 1095 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) 1096 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) 1097 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) 1098 #define FT_FACE_FLAG_HINTER ( 1L << 11 ) 1099 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) 1100 #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) 1101 #define FT_FACE_FLAG_COLOR ( 1L << 14 ) 1102 1103 1104 /************************************************************************* 1105 * 1106 * @macro: 1107 * FT_HAS_HORIZONTAL( face ) 1108 * 1109 * @description: 1110 * A macro that returns true whenever a face object contains 1111 * horizontal metrics (this is true for all font formats though). 1112 * 1113 * @also: 1114 * @FT_HAS_VERTICAL can be used to check for vertical metrics. 1115 * 1116 */ 1117 #define FT_HAS_HORIZONTAL( face ) \ 1118 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) 1119 1120 1121 /************************************************************************* 1122 * 1123 * @macro: 1124 * FT_HAS_VERTICAL( face ) 1125 * 1126 * @description: 1127 * A macro that returns true whenever a face object contains real 1128 * vertical metrics (and not only synthesized ones). 1129 * 1130 */ 1131 #define FT_HAS_VERTICAL( face ) \ 1132 ( face->face_flags & FT_FACE_FLAG_VERTICAL ) 1133 1134 1135 /************************************************************************* 1136 * 1137 * @macro: 1138 * FT_HAS_KERNING( face ) 1139 * 1140 * @description: 1141 * A macro that returns true whenever a face object contains kerning 1142 * data that can be accessed with @FT_Get_Kerning. 1143 * 1144 */ 1145 #define FT_HAS_KERNING( face ) \ 1146 ( face->face_flags & FT_FACE_FLAG_KERNING ) 1147 1148 1149 /************************************************************************* 1150 * 1151 * @macro: 1152 * FT_IS_SCALABLE( face ) 1153 * 1154 * @description: 1155 * A macro that returns true whenever a face object contains a scalable 1156 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, 1157 * and PFR font formats. 1158 * 1159 */ 1160 #define FT_IS_SCALABLE( face ) \ 1161 ( face->face_flags & FT_FACE_FLAG_SCALABLE ) 1162 1163 1164 /************************************************************************* 1165 * 1166 * @macro: 1167 * FT_IS_SFNT( face ) 1168 * 1169 * @description: 1170 * A macro that returns true whenever a face object contains a font 1171 * whose format is based on the SFNT storage scheme. This usually 1172 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded 1173 * bitmap fonts. 1174 * 1175 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and 1176 * @FT_TRUETYPE_TABLES_H are available. 1177 * 1178 */ 1179 #define FT_IS_SFNT( face ) \ 1180 ( face->face_flags & FT_FACE_FLAG_SFNT ) 1181 1182 1183 /************************************************************************* 1184 * 1185 * @macro: 1186 * FT_IS_FIXED_WIDTH( face ) 1187 * 1188 * @description: 1189 * A macro that returns true whenever a face object contains a font face 1190 * that contains fixed-width (or `monospace', `fixed-pitch', etc.) 1191 * glyphs. 1192 * 1193 */ 1194 #define FT_IS_FIXED_WIDTH( face ) \ 1195 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) 1196 1197 1198 /************************************************************************* 1199 * 1200 * @macro: 1201 * FT_HAS_FIXED_SIZES( face ) 1202 * 1203 * @description: 1204 * A macro that returns true whenever a face object contains some 1205 * embedded bitmaps. See the `available_sizes' field of the 1206 * @FT_FaceRec structure. 1207 * 1208 */ 1209 #define FT_HAS_FIXED_SIZES( face ) \ 1210 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) 1211 1212 1213 /************************************************************************* 1214 * 1215 * @macro: 1216 * FT_HAS_FAST_GLYPHS( face ) 1217 * 1218 * @description: 1219 * Deprecated. 1220 * 1221 */ 1222 #define FT_HAS_FAST_GLYPHS( face ) 0 1223 1224 1225 /************************************************************************* 1226 * 1227 * @macro: 1228 * FT_HAS_GLYPH_NAMES( face ) 1229 * 1230 * @description: 1231 * A macro that returns true whenever a face object contains some glyph 1232 * names that can be accessed through @FT_Get_Glyph_Name. 1233 * 1234 */ 1235 #define FT_HAS_GLYPH_NAMES( face ) \ 1236 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) 1237 1238 1239 /************************************************************************* 1240 * 1241 * @macro: 1242 * FT_HAS_MULTIPLE_MASTERS( face ) 1243 * 1244 * @description: 1245 * A macro that returns true whenever a face object contains some 1246 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H 1247 * are then available to choose the exact design you want. 1248 * 1249 */ 1250 #define FT_HAS_MULTIPLE_MASTERS( face ) \ 1251 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) 1252 1253 1254 /************************************************************************* 1255 * 1256 * @macro: 1257 * FT_IS_CID_KEYED( face ) 1258 * 1259 * @description: 1260 * A macro that returns true whenever a face object contains a CID-keyed 1261 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more 1262 * details. 1263 * 1264 * If this macro is true, all functions defined in @FT_CID_H are 1265 * available. 1266 * 1267 */ 1268 #define FT_IS_CID_KEYED( face ) \ 1269 ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) 1270 1271 1272 /************************************************************************* 1273 * 1274 * @macro: 1275 * FT_IS_TRICKY( face ) 1276 * 1277 * @description: 1278 * A macro that returns true whenever a face represents a `tricky' font. 1279 * See the discussion of @FT_FACE_FLAG_TRICKY for more details. 1280 * 1281 */ 1282 #define FT_IS_TRICKY( face ) \ 1283 ( face->face_flags & FT_FACE_FLAG_TRICKY ) 1284 1285 1286 /************************************************************************* 1287 * 1288 * @macro: 1289 * FT_HAS_COLOR( face ) 1290 * 1291 * @description: 1292 * A macro that returns true whenever a face object contains 1293 * tables for color glyphs. 1294 * 1295 */ 1296 #define FT_HAS_COLOR( face ) \ 1297 ( face->face_flags & FT_FACE_FLAG_COLOR ) 1298 1299 1300 /*************************************************************************/ 1301 /* */ 1302 /* <Const> */ 1303 /* FT_STYLE_FLAG_XXX */ 1304 /* */ 1305 /* <Description> */ 1306 /* A list of bit-flags used to indicate the style of a given face. */ 1307 /* These are used in the `style_flags' field of @FT_FaceRec. */ 1308 /* */ 1309 /* <Values> */ 1310 /* FT_STYLE_FLAG_ITALIC :: */ 1311 /* Indicates that a given face style is italic or oblique. */ 1312 /* */ 1313 /* FT_STYLE_FLAG_BOLD :: */ 1314 /* Indicates that a given face is bold. */ 1315 /* */ 1316 /* <Note> */ 1317 /* The style information as provided by FreeType is very basic. More */ 1318 /* details are beyond the scope and should be done on a higher level */ 1319 /* (for example, by analyzing various fields of the `OS/2' table in */ 1320 /* SFNT based fonts). */ 1321 /* */ 1322 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) 1323 #define FT_STYLE_FLAG_BOLD ( 1 << 1 ) 1324 1325 1326 /*************************************************************************/ 1327 /* */ 1328 /* <Type> */ 1329 /* FT_Size_Internal */ 1330 /* */ 1331 /* <Description> */ 1332 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ 1333 /* model private data of a given @FT_Size object. */ 1334 /* */ 1335 typedef struct FT_Size_InternalRec_* FT_Size_Internal; 1336 1337 1338 /*************************************************************************/ 1339 /* */ 1340 /* <Struct> */ 1341 /* FT_Size_Metrics */ 1342 /* */ 1343 /* <Description> */ 1344 /* The size metrics structure gives the metrics of a size object. */ 1345 /* */ 1346 /* <Fields> */ 1347 /* x_ppem :: The width of the scaled EM square in pixels, hence */ 1348 /* the term `ppem' (pixels per EM). It is also */ 1349 /* referred to as `nominal width'. */ 1350 /* */ 1351 /* y_ppem :: The height of the scaled EM square in pixels, */ 1352 /* hence the term `ppem' (pixels per EM). It is also */ 1353 /* referred to as `nominal height'. */ 1354 /* */ 1355 /* x_scale :: A 16.16 fractional scaling value used to convert */ 1356 /* horizontal metrics from font units to 26.6 */ 1357 /* fractional pixels. Only relevant for scalable */ 1358 /* font formats. */ 1359 /* */ 1360 /* y_scale :: A 16.16 fractional scaling value used to convert */ 1361 /* vertical metrics from font units to 26.6 */ 1362 /* fractional pixels. Only relevant for scalable */ 1363 /* font formats. */ 1364 /* */ 1365 /* ascender :: The ascender in 26.6 fractional pixels. See */ 1366 /* @FT_FaceRec for the details. */ 1367 /* */ 1368 /* descender :: The descender in 26.6 fractional pixels. See */ 1369 /* @FT_FaceRec for the details. */ 1370 /* */ 1371 /* height :: The height in 26.6 fractional pixels. See */ 1372 /* @FT_FaceRec for the details. */ 1373 /* */ 1374 /* max_advance :: The maximum advance width in 26.6 fractional */ 1375 /* pixels. See @FT_FaceRec for the details. */ 1376 /* */ 1377 /* <Note> */ 1378 /* The scaling values, if relevant, are determined first during a */ 1379 /* size changing operation. The remaining fields are then set by the */ 1380 /* driver. For scalable formats, they are usually set to scaled */ 1381 /* values of the corresponding fields in @FT_FaceRec. */ 1382 /* */ 1383 /* Note that due to glyph hinting, these values might not be exact */ 1384 /* for certain fonts. Thus they must be treated as unreliable */ 1385 /* with an error margin of at least one pixel! */ 1386 /* */ 1387 /* Indeed, the only way to get the exact metrics is to render _all_ */ 1388 /* glyphs. As this would be a definite performance hit, it is up to */ 1389 /* client applications to perform such computations. */ 1390 /* */ 1391 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */ 1392 /* */ 1393 typedef struct FT_Size_Metrics_ 1394 { 1395 FT_UShort x_ppem; /* horizontal pixels per EM */ 1396 FT_UShort y_ppem; /* vertical pixels per EM */ 1397 1398 FT_Fixed x_scale; /* scaling values used to convert font */ 1399 FT_Fixed y_scale; /* units to 26.6 fractional pixels */ 1400 1401 FT_Pos ascender; /* ascender in 26.6 frac. pixels */ 1402 FT_Pos descender; /* descender in 26.6 frac. pixels */ 1403 FT_Pos height; /* text height in 26.6 frac. pixels */ 1404 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ 1405 1406 } FT_Size_Metrics; 1407 1408 1409 /*************************************************************************/ 1410 /* */ 1411 /* <Struct> */ 1412 /* FT_SizeRec */ 1413 /* */ 1414 /* <Description> */ 1415 /* FreeType root size class structure. A size object models a face */ 1416 /* object at a given size. */ 1417 /* */ 1418 /* <Fields> */ 1419 /* face :: Handle to the parent face object. */ 1420 /* */ 1421 /* generic :: A typeless pointer, unused by the FreeType library or */ 1422 /* any of its drivers. It can be used by client */ 1423 /* applications to link their own data to each size */ 1424 /* object. */ 1425 /* */ 1426 /* metrics :: Metrics for this size object. This field is read-only. */ 1427 /* */ 1428 typedef struct FT_SizeRec_ 1429 { 1430 FT_Face face; /* parent face object */ 1431 FT_Generic generic; /* generic pointer for client uses */ 1432 FT_Size_Metrics metrics; /* size metrics */ 1433 FT_Size_Internal internal; 1434 1435 } FT_SizeRec; 1436 1437 1438 /*************************************************************************/ 1439 /* */ 1440 /* <Struct> */ 1441 /* FT_SubGlyph */ 1442 /* */ 1443 /* <Description> */ 1444 /* The subglyph structure is an internal object used to describe */ 1445 /* subglyphs (for example, in the case of composites). */ 1446 /* */ 1447 /* <Note> */ 1448 /* The subglyph implementation is not part of the high-level API, */ 1449 /* hence the forward structure declaration. */ 1450 /* */ 1451 /* You can however retrieve subglyph information with */ 1452 /* @FT_Get_SubGlyph_Info. */ 1453 /* */ 1454 typedef struct FT_SubGlyphRec_* FT_SubGlyph; 1455 1456 1457 /*************************************************************************/ 1458 /* */ 1459 /* <Type> */ 1460 /* FT_Slot_Internal */ 1461 /* */ 1462 /* <Description> */ 1463 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ 1464 /* model private data of a given @FT_GlyphSlot object. */ 1465 /* */ 1466 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; 1467 1468 1469 /*************************************************************************/ 1470 /* */ 1471 /* <Struct> */ 1472 /* FT_GlyphSlotRec */ 1473 /* */ 1474 /* <Description> */ 1475 /* FreeType root glyph slot class structure. A glyph slot is a */ 1476 /* container where individual glyphs can be loaded, be they in */ 1477 /* outline or bitmap format. */ 1478 /* */ 1479 /* <Fields> */ 1480 /* library :: A handle to the FreeType library instance */ 1481 /* this slot belongs to. */ 1482 /* */ 1483 /* face :: A handle to the parent face object. */ 1484 /* */ 1485 /* next :: In some cases (like some font tools), several */ 1486 /* glyph slots per face object can be a good */ 1487 /* thing. As this is rare, the glyph slots are */ 1488 /* listed through a direct, single-linked list */ 1489 /* using its `next' field. */ 1490 /* */ 1491 /* generic :: A typeless pointer unused by the FreeType */ 1492 /* library or any of its drivers. It can be */ 1493 /* used by client applications to link their own */ 1494 /* data to each glyph slot object. */ 1495 /* */ 1496 /* metrics :: The metrics of the last loaded glyph in the */ 1497 /* slot. The returned values depend on the last */ 1498 /* load flags (see the @FT_Load_Glyph API */ 1499 /* function) and can be expressed either in 26.6 */ 1500 /* fractional pixels or font units. */ 1501 /* */ 1502 /* Note that even when the glyph image is */ 1503 /* transformed, the metrics are not. */ 1504 /* */ 1505 /* linearHoriAdvance :: The advance width of the unhinted glyph. */ 1506 /* Its value is expressed in 16.16 fractional */ 1507 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ 1508 /* when loading the glyph. This field can be */ 1509 /* important to perform correct WYSIWYG layout. */ 1510 /* Only relevant for outline glyphs. */ 1511 /* */ 1512 /* linearVertAdvance :: The advance height of the unhinted glyph. */ 1513 /* Its value is expressed in 16.16 fractional */ 1514 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ 1515 /* when loading the glyph. This field can be */ 1516 /* important to perform correct WYSIWYG layout. */ 1517 /* Only relevant for outline glyphs. */ 1518 /* */ 1519 /* advance :: This shorthand is, depending on */ 1520 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ 1521 /* (hinted) advance width for the glyph, in 26.6 */ 1522 /* fractional pixel format. As specified with */ 1523 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ 1524 /* `horiAdvance' or the `vertAdvance' value of */ 1525 /* `metrics' field. */ 1526 /* */ 1527 /* format :: This field indicates the format of the image */ 1528 /* contained in the glyph slot. Typically */ 1529 /* @FT_GLYPH_FORMAT_BITMAP, */ 1530 /* @FT_GLYPH_FORMAT_OUTLINE, or */ 1531 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */ 1532 /* possible. */ 1533 /* */ 1534 /* bitmap :: This field is used as a bitmap descriptor */ 1535 /* when the slot format is */ 1536 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ 1537 /* address and content of the bitmap buffer can */ 1538 /* change between calls of @FT_Load_Glyph and a */ 1539 /* few other functions. */ 1540 /* */ 1541 /* bitmap_left :: This is the bitmap's left bearing expressed */ 1542 /* in integer pixels. Of course, this is only */ 1543 /* valid if the format is */ 1544 /* @FT_GLYPH_FORMAT_BITMAP. */ 1545 /* */ 1546 /* bitmap_top :: This is the bitmap's top bearing expressed in */ 1547 /* integer pixels. Remember that this is the */ 1548 /* distance from the baseline to the top-most */ 1549 /* glyph scanline, upwards y~coordinates being */ 1550 /* *positive*. */ 1551 /* */ 1552 /* outline :: The outline descriptor for the current glyph */ 1553 /* image if its format is */ 1554 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ 1555 /* loaded, `outline' can be transformed, */ 1556 /* distorted, embolded, etc. However, it must */ 1557 /* not be freed. */ 1558 /* */ 1559 /* num_subglyphs :: The number of subglyphs in a composite glyph. */ 1560 /* This field is only valid for the composite */ 1561 /* glyph format that should normally only be */ 1562 /* loaded with the @FT_LOAD_NO_RECURSE flag. */ 1563 /* For now this is internal to FreeType. */ 1564 /* */ 1565 /* subglyphs :: An array of subglyph descriptors for */ 1566 /* composite glyphs. There are `num_subglyphs' */ 1567 /* elements in there. Currently internal to */ 1568 /* FreeType. */ 1569 /* */ 1570 /* control_data :: Certain font drivers can also return the */ 1571 /* control data for a given glyph image (e.g. */ 1572 /* TrueType bytecode, Type~1 charstrings, etc.). */ 1573 /* This field is a pointer to such data. */ 1574 /* */ 1575 /* control_len :: This is the length in bytes of the control */ 1576 /* data. */ 1577 /* */ 1578 /* other :: Really wicked formats can use this pointer to */ 1579 /* present their own glyph image to client */ 1580 /* applications. Note that the application */ 1581 /* needs to know about the image format. */ 1582 /* */ 1583 /* lsb_delta :: The difference between hinted and unhinted */ 1584 /* left side bearing while autohinting is */ 1585 /* active. Zero otherwise. */ 1586 /* */ 1587 /* rsb_delta :: The difference between hinted and unhinted */ 1588 /* right side bearing while autohinting is */ 1589 /* active. Zero otherwise. */ 1590 /* */ 1591 /* <Note> */ 1592 /* If @FT_Load_Glyph is called with default flags (see */ 1593 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ 1594 /* its native format (e.g., an outline glyph for TrueType and Type~1 */ 1595 /* formats). */ 1596 /* */ 1597 /* This image can later be converted into a bitmap by calling */ 1598 /* @FT_Render_Glyph. This function finds the current renderer for */ 1599 /* the native image's format, then invokes it. */ 1600 /* */ 1601 /* The renderer is in charge of transforming the native image through */ 1602 /* the slot's face transformation fields, then converting it into a */ 1603 /* bitmap that is returned in `slot->bitmap'. */ 1604 /* */ 1605 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ 1606 /* to specify the position of the bitmap relative to the current pen */ 1607 /* position (e.g., coordinates (0,0) on the baseline). Of course, */ 1608 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ 1609 /* */ 1610 /* <Note> */ 1611 /* Here a small pseudo code fragment that shows how to use */ 1612 /* `lsb_delta' and `rsb_delta': */ 1613 /* */ 1614 /* { */ 1615 /* FT_Pos origin_x = 0; */ 1616 /* FT_Pos prev_rsb_delta = 0; */ 1617 /* */ 1618 /* */ 1619 /* for all glyphs do */ 1620 /* <compute kern between current and previous glyph and add it to */ 1621 /* `origin_x'> */ 1622 /* */ 1623 /* <load glyph with `FT_Load_Glyph'> */ 1624 /* */ 1625 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ 1626 /* origin_x -= 64; */ 1627 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ 1628 /* origin_x += 64; */ 1629 /* */ 1630 /* prev_rsb_delta = face->glyph->rsb_delta; */ 1631 /* */ 1632 /* <save glyph image, or render glyph, or ...> */ 1633 /* */ 1634 /* origin_x += face->glyph->advance.x; */ 1635 /* endfor */ 1636 /* } */ 1637 /* */ 1638 typedef struct FT_GlyphSlotRec_ 1639 { 1640 FT_Library library; 1641 FT_Face face; 1642 FT_GlyphSlot next; 1643 FT_UInt reserved; /* retained for binary compatibility */ 1644 FT_Generic generic; 1645 1646 FT_Glyph_Metrics metrics; 1647 FT_Fixed linearHoriAdvance; 1648 FT_Fixed linearVertAdvance; 1649 FT_Vector advance; 1650 1651 FT_Glyph_Format format; 1652 1653 FT_Bitmap bitmap; 1654 FT_Int bitmap_left; 1655 FT_Int bitmap_top; 1656 1657 FT_Outline outline; 1658 1659 FT_UInt num_subglyphs; 1660 FT_SubGlyph subglyphs; 1661 1662 void* control_data; 1663 long control_len; 1664 1665 FT_Pos lsb_delta; 1666 FT_Pos rsb_delta; 1667 1668 void* other; 1669 1670 FT_Slot_Internal internal; 1671 1672 } FT_GlyphSlotRec; 1673 1674 1675 /*************************************************************************/ 1676 /*************************************************************************/ 1677 /* */ 1678 /* F U N C T I O N S */ 1679 /* */ 1680 /*************************************************************************/ 1681 /*************************************************************************/ 1682 1683 1684 /*************************************************************************/ 1685 /* */ 1686 /* <Function> */ 1687 /* FT_Init_FreeType */ 1688 /* */ 1689 /* <Description> */ 1690 /* Initialize a new FreeType library object. The set of modules */ 1691 /* that are registered by this function is determined at build time. */ 1692 /* */ 1693 /* <Output> */ 1694 /* alibrary :: A handle to a new library object. */ 1695 /* */ 1696 /* <Return> */ 1697 /* FreeType error code. 0~means success. */ 1698 /* */ 1699 /* <Note> */ 1700 /* In case you want to provide your own memory allocating routines, */ 1701 /* use @FT_New_Library instead, followed by a call to */ 1702 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ 1703 /* */ 1704 /* For multi-threading applications each thread should have its own */ 1705 /* FT_Library object. */ 1706 /* */ 1707 /* If you need reference-counting (cf. @FT_Reference_Library), use */ 1708 /* @FT_New_Library and @FT_Done_Library. */ 1709 /* */ 1710 FT_EXPORT( FT_Error ) 1711 FT_Init_FreeType( FT_Library *alibrary ); 1712 1713 1714 /*************************************************************************/ 1715 /* */ 1716 /* <Function> */ 1717 /* FT_Done_FreeType */ 1718 /* */ 1719 /* <Description> */ 1720 /* Destroy a given FreeType library object and all of its children, */ 1721 /* including resources, drivers, faces, sizes, etc. */ 1722 /* */ 1723 /* <Input> */ 1724 /* library :: A handle to the target library object. */ 1725 /* */ 1726 /* <Return> */ 1727 /* FreeType error code. 0~means success. */ 1728 /* */ 1729 FT_EXPORT( FT_Error ) 1730 FT_Done_FreeType( FT_Library library ); 1731 1732 1733 /*************************************************************************/ 1734 /* */ 1735 /* <Enum> */ 1736 /* FT_OPEN_XXX */ 1737 /* */ 1738 /* <Description> */ 1739 /* A list of bit-field constants used within the `flags' field of the */ 1740 /* @FT_Open_Args structure. */ 1741 /* */ 1742 /* <Values> */ 1743 /* FT_OPEN_MEMORY :: This is a memory-based stream. */ 1744 /* */ 1745 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ 1746 /* */ 1747 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ 1748 /* name. */ 1749 /* */ 1750 /* FT_OPEN_DRIVER :: Use the `driver' field. */ 1751 /* */ 1752 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ 1753 /* */ 1754 /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ 1755 /* */ 1756 /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ 1757 /* */ 1758 /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ 1759 /* */ 1760 /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ 1761 /* */ 1762 /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ 1763 /* */ 1764 /* <Note> */ 1765 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ 1766 /* flags are mutually exclusive. */ 1767 /* */ 1768 #define FT_OPEN_MEMORY 0x1 1769 #define FT_OPEN_STREAM 0x2 1770 #define FT_OPEN_PATHNAME 0x4 1771 #define FT_OPEN_DRIVER 0x8 1772 #define FT_OPEN_PARAMS 0x10 1773 1774 #define ft_open_memory FT_OPEN_MEMORY /* deprecated */ 1775 #define ft_open_stream FT_OPEN_STREAM /* deprecated */ 1776 #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ 1777 #define ft_open_driver FT_OPEN_DRIVER /* deprecated */ 1778 #define ft_open_params FT_OPEN_PARAMS /* deprecated */ 1779 1780 1781 /*************************************************************************/ 1782 /* */ 1783 /* <Struct> */ 1784 /* FT_Parameter */ 1785 /* */ 1786 /* <Description> */ 1787 /* A simple structure used to pass more or less generic parameters to */ 1788 /* @FT_Open_Face. */ 1789 /* */ 1790 /* <Fields> */ 1791 /* tag :: A four-byte identification tag. */ 1792 /* */ 1793 /* data :: A pointer to the parameter data. */ 1794 /* */ 1795 /* <Note> */ 1796 /* The ID and function of parameters are driver-specific. See the */ 1797 /* various FT_PARAM_TAG_XXX flags for more information. */ 1798 /* */ 1799 typedef struct FT_Parameter_ 1800 { 1801 FT_ULong tag; 1802 FT_Pointer data; 1803 1804 } FT_Parameter; 1805 1806 1807 /*************************************************************************/ 1808 /* */ 1809 /* <Struct> */ 1810 /* FT_Open_Args */ 1811 /* */ 1812 /* <Description> */ 1813 /* A structure used to indicate how to open a new font file or */ 1814 /* stream. A pointer to such a structure can be used as a parameter */ 1815 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */ 1816 /* */ 1817 /* <Fields> */ 1818 /* flags :: A set of bit flags indicating how to use the */ 1819 /* structure. */ 1820 /* */ 1821 /* memory_base :: The first byte of the file in memory. */ 1822 /* */ 1823 /* memory_size :: The size in bytes of the file in memory. */ 1824 /* */ 1825 /* pathname :: A pointer to an 8-bit file pathname. */ 1826 /* */ 1827 /* stream :: A handle to a source stream object. */ 1828 /* */ 1829 /* driver :: This field is exclusively used by @FT_Open_Face; */ 1830 /* it simply specifies the font driver to use to open */ 1831 /* the face. If set to~0, FreeType tries to load the */ 1832 /* face with each one of the drivers in its list. */ 1833 /* */ 1834 /* num_params :: The number of extra parameters. */ 1835 /* */ 1836 /* params :: Extra parameters passed to the font driver when */ 1837 /* opening a new face. */ 1838 /* */ 1839 /* <Note> */ 1840 /* The stream type is determined by the contents of `flags' that */ 1841 /* are tested in the following order by @FT_Open_Face: */ 1842 /* */ 1843 /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ 1844 /* memory file of `memory_size' bytes, located at `memory_address'. */ 1845 /* The data are are not copied, and the client is responsible for */ 1846 /* releasing and destroying them _after_ the corresponding call to */ 1847 /* @FT_Done_Face. */ 1848 /* */ 1849 /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ 1850 /* custom input stream `stream' is used. */ 1851 /* */ 1852 /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ 1853 /* is a normal file and use `pathname' to open it. */ 1854 /* */ 1855 /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */ 1856 /* open the file with the driver whose handler is in `driver'. */ 1857 /* */ 1858 /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ 1859 /* `num_params' and `params' is used. They are ignored otherwise. */ 1860 /* */ 1861 /* Ideally, both the `pathname' and `params' fields should be tagged */ 1862 /* as `const'; this is missing for API backwards compatibility. In */ 1863 /* other words, applications should treat them as read-only. */ 1864 /* */ 1865 typedef struct FT_Open_Args_ 1866 { 1867 FT_UInt flags; 1868 const FT_Byte* memory_base; 1869 FT_Long memory_size; 1870 FT_String* pathname; 1871 FT_Stream stream; 1872 FT_Module driver; 1873 FT_Int num_params; 1874 FT_Parameter* params; 1875 1876 } FT_Open_Args; 1877 1878 1879 /*************************************************************************/ 1880 /* */ 1881 /* <Function> */ 1882 /* FT_New_Face */ 1883 /* */ 1884 /* <Description> */ 1885 /* This function calls @FT_Open_Face to open a font by its pathname. */ 1886 /* */ 1887 /* <InOut> */ 1888 /* library :: A handle to the library resource. */ 1889 /* */ 1890 /* <Input> */ 1891 /* pathname :: A path to the font file. */ 1892 /* */ 1893 /* face_index :: The index of the face within the font. The first */ 1894 /* face has index~0. */ 1895 /* */ 1896 /* <Output> */ 1897 /* aface :: A handle to a new face object. If `face_index' is */ 1898 /* greater than or equal to zero, it must be non-NULL. */ 1899 /* See @FT_Open_Face for more details. */ 1900 /* */ 1901 /* <Return> */ 1902 /* FreeType error code. 0~means success. */ 1903 /* */ 1904 /* <Note> */ 1905 /* Use @FT_Done_Face to destroy the created @FT_Face object (along */ 1906 /* with its slot and sizes). */ 1907 /* */ 1908 FT_EXPORT( FT_Error ) 1909 FT_New_Face( FT_Library library, 1910 const char* filepathname, 1911 FT_Long face_index, 1912 FT_Face *aface ); 1913 1914 1915 /*************************************************************************/ 1916 /* */ 1917 /* <Function> */ 1918 /* FT_New_Memory_Face */ 1919 /* */ 1920 /* <Description> */ 1921 /* This function calls @FT_Open_Face to open a font that has been */ 1922 /* loaded into memory. */ 1923 /* */ 1924 /* <InOut> */ 1925 /* library :: A handle to the library resource. */ 1926 /* */ 1927 /* <Input> */ 1928 /* file_base :: A pointer to the beginning of the font data. */ 1929 /* */ 1930 /* file_size :: The size of the memory chunk used by the font data. */ 1931 /* */ 1932 /* face_index :: The index of the face within the font. The first */ 1933 /* face has index~0. */ 1934 /* */ 1935 /* <Output> */ 1936 /* aface :: A handle to a new face object. If `face_index' is */ 1937 /* greater than or equal to zero, it must be non-NULL. */ 1938 /* See @FT_Open_Face for more details. */ 1939 /* */ 1940 /* <Return> */ 1941 /* FreeType error code. 0~means success. */ 1942 /* */ 1943 /* <Note> */ 1944 /* You must not deallocate the memory before calling @FT_Done_Face. */ 1945 /* */ 1946 FT_EXPORT( FT_Error ) 1947 FT_New_Memory_Face( FT_Library library, 1948 const FT_Byte* file_base, 1949 FT_Long file_size, 1950 FT_Long face_index, 1951 FT_Face *aface ); 1952 1953 1954 /*************************************************************************/ 1955 /* */ 1956 /* <Function> */ 1957 /* FT_Open_Face */ 1958 /* */ 1959 /* <Description> */ 1960 /* Create a face object from a given resource described by */ 1961 /* @FT_Open_Args. */ 1962 /* */ 1963 /* <InOut> */ 1964 /* library :: A handle to the library resource. */ 1965 /* */ 1966 /* <Input> */ 1967 /* args :: A pointer to an `FT_Open_Args' structure that must */ 1968 /* be filled by the caller. */ 1969 /* */ 1970 /* face_index :: The index of the face within the font. The first */ 1971 /* face has index~0. */ 1972 /* */ 1973 /* <Output> */ 1974 /* aface :: A handle to a new face object. If `face_index' is */ 1975 /* greater than or equal to zero, it must be non-NULL. */ 1976 /* See note below. */ 1977 /* */ 1978 /* <Return> */ 1979 /* FreeType error code. 0~means success. */ 1980 /* */ 1981 /* <Note> */ 1982 /* Unlike FreeType 1.x, this function automatically creates a glyph */ 1983 /* slot for the face object that can be accessed directly through */ 1984 /* `face->glyph'. */ 1985 /* */ 1986 /* FT_Open_Face can be used to quickly check whether the font */ 1987 /* format of a given font resource is supported by FreeType. If the */ 1988 /* `face_index' field is negative, the function's return value is~0 */ 1989 /* if the font format is recognized, or non-zero otherwise; */ 1990 /* the function returns a more or less empty face handle in `*aface' */ 1991 /* (if `aface' isn't NULL). The only useful field in this special */ 1992 /* case is `face->num_faces' that gives the number of faces within */ 1993 /* the font file. After examination, the returned @FT_Face structure */ 1994 /* should be deallocated with a call to @FT_Done_Face. */ 1995 /* */ 1996 /* Each new face object created with this function also owns a */ 1997 /* default @FT_Size object, accessible as `face->size'. */ 1998 /* */ 1999 /* One @FT_Library instance can have multiple face objects, this is, */ 2000 /* @FT_Open_Face and its siblings can be called multiple times using */ 2001 /* the same `library' argument. */ 2002 /* */ 2003 /* See the discussion of reference counters in the description of */ 2004 /* @FT_Reference_Face. */ 2005 /* */ 2006 FT_EXPORT( FT_Error ) 2007 FT_Open_Face( FT_Library library, 2008 const FT_Open_Args* args, 2009 FT_Long face_index, 2010 FT_Face *aface ); 2011 2012 2013 /*************************************************************************/ 2014 /* */ 2015 /* <Function> */ 2016 /* FT_Attach_File */ 2017 /* */ 2018 /* <Description> */ 2019 /* This function calls @FT_Attach_Stream to attach a file. */ 2020 /* */ 2021 /* <InOut> */ 2022 /* face :: The target face object. */ 2023 /* */ 2024 /* <Input> */ 2025 /* filepathname :: The pathname. */ 2026 /* */ 2027 /* <Return> */ 2028 /* FreeType error code. 0~means success. */ 2029 /* */ 2030 FT_EXPORT( FT_Error ) 2031 FT_Attach_File( FT_Face face, 2032 const char* filepathname ); 2033 2034 2035 /*************************************************************************/ 2036 /* */ 2037 /* <Function> */ 2038 /* FT_Attach_Stream */ 2039 /* */ 2040 /* <Description> */ 2041 /* `Attach' data to a face object. Normally, this is used to read */ 2042 /* additional information for the face object. For example, you can */ 2043 /* attach an AFM file that comes with a Type~1 font to get the */ 2044 /* kerning values and other metrics. */ 2045 /* */ 2046 /* <InOut> */ 2047 /* face :: The target face object. */ 2048 /* */ 2049 /* <Input> */ 2050 /* parameters :: A pointer to @FT_Open_Args that must be filled by */ 2051 /* the caller. */ 2052 /* */ 2053 /* <Return> */ 2054 /* FreeType error code. 0~means success. */ 2055 /* */ 2056 /* <Note> */ 2057 /* The meaning of the `attach' (i.e., what really happens when the */ 2058 /* new file is read) is not fixed by FreeType itself. It really */ 2059 /* depends on the font format (and thus the font driver). */ 2060 /* */ 2061 /* Client applications are expected to know what they are doing */ 2062 /* when invoking this function. Most drivers simply do not implement */ 2063 /* file attachments. */ 2064 /* */ 2065 FT_EXPORT( FT_Error ) 2066 FT_Attach_Stream( FT_Face face, 2067 FT_Open_Args* parameters ); 2068 2069 2070 /*************************************************************************/ 2071 /* */ 2072 /* <Function> */ 2073 /* FT_Reference_Face */ 2074 /* */ 2075 /* <Description> */ 2076 /* A counter gets initialized to~1 at the time an @FT_Face structure */ 2077 /* is created. This function increments the counter. @FT_Done_Face */ 2078 /* then only destroys a face if the counter is~1, otherwise it simply */ 2079 /* decrements the counter. */ 2080 /* */ 2081 /* This function helps in managing life-cycles of structures that */ 2082 /* reference @FT_Face objects. */ 2083 /* */ 2084 /* <Input> */ 2085 /* face :: A handle to a target face object. */ 2086 /* */ 2087 /* <Return> */ 2088 /* FreeType error code. 0~means success. */ 2089 /* */ 2090 /* <Since> */ 2091 /* 2.4.2 */ 2092 /* */ 2093 FT_EXPORT( FT_Error ) 2094 FT_Reference_Face( FT_Face face ); 2095 2096 2097 /*************************************************************************/ 2098 /* */ 2099 /* <Function> */ 2100 /* FT_Done_Face */ 2101 /* */ 2102 /* <Description> */ 2103 /* Discard a given face object, as well as all of its child slots and */ 2104 /* sizes. */ 2105 /* */ 2106 /* <Input> */ 2107 /* face :: A handle to a target face object. */ 2108 /* */ 2109 /* <Return> */ 2110 /* FreeType error code. 0~means success. */ 2111 /* */ 2112 /* <Note> */ 2113 /* See the discussion of reference counters in the description of */ 2114 /* @FT_Reference_Face. */ 2115 /* */ 2116 FT_EXPORT( FT_Error ) 2117 FT_Done_Face( FT_Face face ); 2118 2119 2120 /*************************************************************************/ 2121 /* */ 2122 /* <Function> */ 2123 /* FT_Select_Size */ 2124 /* */ 2125 /* <Description> */ 2126 /* Select a bitmap strike. */ 2127 /* */ 2128 /* <InOut> */ 2129 /* face :: A handle to a target face object. */ 2130 /* */ 2131 /* <Input> */ 2132 /* strike_index :: The index of the bitmap strike in the */ 2133 /* `available_sizes' field of @FT_FaceRec structure. */ 2134 /* */ 2135 /* <Return> */ 2136 /* FreeType error code. 0~means success. */ 2137 /* */ 2138 FT_EXPORT( FT_Error ) 2139 FT_Select_Size( FT_Face face, 2140 FT_Int strike_index ); 2141 2142 2143 /*************************************************************************/ 2144 /* */ 2145 /* <Enum> */ 2146 /* FT_Size_Request_Type */ 2147 /* */ 2148 /* <Description> */ 2149 /* An enumeration type that lists the supported size request types. */ 2150 /* */ 2151 /* <Values> */ 2152 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ 2153 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ 2154 /* used to determine both scaling values. */ 2155 /* */ 2156 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ 2157 /* The real dimension. The sum of the the `ascender' and (minus */ 2158 /* of) the `descender' fields of @FT_FaceRec are used to determine */ 2159 /* both scaling values. */ 2160 /* */ 2161 /* FT_SIZE_REQUEST_TYPE_BBOX :: */ 2162 /* The font bounding box. The width and height of the `bbox' field */ 2163 /* of @FT_FaceRec are used to determine the horizontal and vertical */ 2164 /* scaling value, respectively. */ 2165 /* */ 2166 /* FT_SIZE_REQUEST_TYPE_CELL :: */ 2167 /* The `max_advance_width' field of @FT_FaceRec is used to */ 2168 /* determine the horizontal scaling value; the vertical scaling */ 2169 /* value is determined the same way as */ 2170 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ 2171 /* values are set to the smaller one. This type is useful if you */ 2172 /* want to specify the font size for, say, a window of a given */ 2173 /* dimension and 80x24 cells. */ 2174 /* */ 2175 /* FT_SIZE_REQUEST_TYPE_SCALES :: */ 2176 /* Specify the scaling values directly. */ 2177 /* */ 2178 /* <Note> */ 2179 /* The above descriptions only apply to scalable formats. For bitmap */ 2180 /* formats, the behaviour is up to the driver. */ 2181 /* */ 2182 /* See the note section of @FT_Size_Metrics if you wonder how size */ 2183 /* requesting relates to scaling values. */ 2184 /* */ 2185 typedef enum FT_Size_Request_Type_ 2186 { 2187 FT_SIZE_REQUEST_TYPE_NOMINAL, 2188 FT_SIZE_REQUEST_TYPE_REAL_DIM, 2189 FT_SIZE_REQUEST_TYPE_BBOX, 2190 FT_SIZE_REQUEST_TYPE_CELL, 2191 FT_SIZE_REQUEST_TYPE_SCALES, 2192 2193 FT_SIZE_REQUEST_TYPE_MAX 2194 2195 } FT_Size_Request_Type; 2196 2197 2198 /*************************************************************************/ 2199 /* */ 2200 /* <Struct> */ 2201 /* FT_Size_RequestRec */ 2202 /* */ 2203 /* <Description> */ 2204 /* A structure used to model a size request. */ 2205 /* */ 2206 /* <Fields> */ 2207 /* type :: See @FT_Size_Request_Type. */ 2208 /* */ 2209 /* width :: The desired width. */ 2210 /* */ 2211 /* height :: The desired height. */ 2212 /* */ 2213 /* horiResolution :: The horizontal resolution. If set to zero, */ 2214 /* `width' is treated as a 26.6 fractional pixel */ 2215 /* value. */ 2216 /* */ 2217 /* vertResolution :: The vertical resolution. If set to zero, */ 2218 /* `height' is treated as a 26.6 fractional pixel */ 2219 /* value. */ 2220 /* */ 2221 /* <Note> */ 2222 /* If `width' is zero, then the horizontal scaling value is set equal */ 2223 /* to the vertical scaling value, and vice versa. */ 2224 /* */ 2225 typedef struct FT_Size_RequestRec_ 2226 { 2227 FT_Size_Request_Type type; 2228 FT_Long width; 2229 FT_Long height; 2230 FT_UInt horiResolution; 2231 FT_UInt vertResolution; 2232 2233 } FT_Size_RequestRec; 2234 2235 2236 /*************************************************************************/ 2237 /* */ 2238 /* <Struct> */ 2239 /* FT_Size_Request */ 2240 /* */ 2241 /* <Description> */ 2242 /* A handle to a size request structure. */ 2243 /* */ 2244 typedef struct FT_Size_RequestRec_ *FT_Size_Request; 2245 2246 2247 /*************************************************************************/ 2248 /* */ 2249 /* <Function> */ 2250 /* FT_Request_Size */ 2251 /* */ 2252 /* <Description> */ 2253 /* Resize the scale of the active @FT_Size object in a face. */ 2254 /* */ 2255 /* <InOut> */ 2256 /* face :: A handle to a target face object. */ 2257 /* */ 2258 /* <Input> */ 2259 /* req :: A pointer to a @FT_Size_RequestRec. */ 2260 /* */ 2261 /* <Return> */ 2262 /* FreeType error code. 0~means success. */ 2263 /* */ 2264 /* <Note> */ 2265 /* Although drivers may select the bitmap strike matching the */ 2266 /* request, you should not rely on this if you intend to select a */ 2267 /* particular bitmap strike. Use @FT_Select_Size instead in that */ 2268 /* case. */ 2269 /* */ 2270 /* The relation between the requested size and the resulting glyph */ 2271 /* size is dependent entirely on how the size is defined in the */ 2272 /* source face. The font designer chooses the final size of each */ 2273 /* glyph relative to this size. For more information refer to */ 2274 /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */ 2275 /* */ 2276 FT_EXPORT( FT_Error ) 2277 FT_Request_Size( FT_Face face, 2278 FT_Size_Request req ); 2279 2280 2281 /*************************************************************************/ 2282 /* */ 2283 /* <Function> */ 2284 /* FT_Set_Char_Size */ 2285 /* */ 2286 /* <Description> */ 2287 /* This function calls @FT_Request_Size to request the nominal size */ 2288 /* (in points). */ 2289 /* */ 2290 /* <InOut> */ 2291 /* face :: A handle to a target face object. */ 2292 /* */ 2293 /* <Input> */ 2294 /* char_width :: The nominal width, in 26.6 fractional points. */ 2295 /* */ 2296 /* char_height :: The nominal height, in 26.6 fractional points. */ 2297 /* */ 2298 /* horz_resolution :: The horizontal resolution in dpi. */ 2299 /* */ 2300 /* vert_resolution :: The vertical resolution in dpi. */ 2301 /* */ 2302 /* <Return> */ 2303 /* FreeType error code. 0~means success. */ 2304 /* */ 2305 /* <Note> */ 2306 /* If either the character width or height is zero, it is set equal */ 2307 /* to the other value. */ 2308 /* */ 2309 /* If either the horizontal or vertical resolution is zero, it is set */ 2310 /* equal to the other value. */ 2311 /* */ 2312 /* A character width or height smaller than 1pt is set to 1pt; if */ 2313 /* both resolution values are zero, they are set to 72dpi. */ 2314 /* */ 2315 /* Don't use this function if you are using the FreeType cache API. */ 2316 /* */ 2317 FT_EXPORT( FT_Error ) 2318 FT_Set_Char_Size( FT_Face face, 2319 FT_F26Dot6 char_width, 2320 FT_F26Dot6 char_height, 2321 FT_UInt horz_resolution, 2322 FT_UInt vert_resolution ); 2323 2324 2325 /*************************************************************************/ 2326 /* */ 2327 /* <Function> */ 2328 /* FT_Set_Pixel_Sizes */ 2329 /* */ 2330 /* <Description> */ 2331 /* This function calls @FT_Request_Size to request the nominal size */ 2332 /* (in pixels). */ 2333 /* */ 2334 /* <InOut> */ 2335 /* face :: A handle to the target face object. */ 2336 /* */ 2337 /* <Input> */ 2338 /* pixel_width :: The nominal width, in pixels. */ 2339 /* */ 2340 /* pixel_height :: The nominal height, in pixels. */ 2341 /* */ 2342 /* <Return> */ 2343 /* FreeType error code. 0~means success. */ 2344 /* */ 2345 /* <Note> */ 2346 /* You should not rely on the resulting glyphs matching, or being */ 2347 /* constrained, to this pixel size. Refer to @FT_Request_Size to */ 2348 /* understand how requested sizes relate to actual sizes. */ 2349 /* */ 2350 FT_EXPORT( FT_Error ) 2351 FT_Set_Pixel_Sizes( FT_Face face, 2352 FT_UInt pixel_width, 2353 FT_UInt pixel_height ); 2354 2355 2356 /*************************************************************************/ 2357 /* */ 2358 /* <Function> */ 2359 /* FT_Load_Glyph */ 2360 /* */ 2361 /* <Description> */ 2362 /* A function used to load a single glyph into the glyph slot of a */ 2363 /* face object. */ 2364 /* */ 2365 /* <InOut> */ 2366 /* face :: A handle to the target face object where the glyph */ 2367 /* is loaded. */ 2368 /* */ 2369 /* <Input> */ 2370 /* glyph_index :: The index of the glyph in the font file. For */ 2371 /* CID-keyed fonts (either in PS or in CFF format) */ 2372 /* this argument specifies the CID value. */ 2373 /* */ 2374 /* load_flags :: A flag indicating what to load for this glyph. The */ 2375 /* @FT_LOAD_XXX constants can be used to control the */ 2376 /* glyph loading process (e.g., whether the outline */ 2377 /* should be scaled, whether to load bitmaps or not, */ 2378 /* whether to hint the outline, etc). */ 2379 /* */ 2380 /* <Return> */ 2381 /* FreeType error code. 0~means success. */ 2382 /* */ 2383 /* <Note> */ 2384 /* The loaded glyph may be transformed. See @FT_Set_Transform for */ 2385 /* the details. */ 2386 /* */ 2387 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ 2388 /* returned for invalid CID values (this is, for CID values that */ 2389 /* don't have a corresponding glyph in the font). See the discussion */ 2390 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ 2391 /* */ 2392 FT_EXPORT( FT_Error ) 2393 FT_Load_Glyph( FT_Face face, 2394 FT_UInt glyph_index, 2395 FT_Int32 load_flags ); 2396 2397 2398 /*************************************************************************/ 2399 /* */ 2400 /* <Function> */ 2401 /* FT_Load_Char */ 2402 /* */ 2403 /* <Description> */ 2404 /* A function used to load a single glyph into the glyph slot of a */ 2405 /* face object, according to its character code. */ 2406 /* */ 2407 /* <InOut> */ 2408 /* face :: A handle to a target face object where the glyph */ 2409 /* is loaded. */ 2410 /* */ 2411 /* <Input> */ 2412 /* char_code :: The glyph's character code, according to the */ 2413 /* current charmap used in the face. */ 2414 /* */ 2415 /* load_flags :: A flag indicating what to load for this glyph. The */ 2416 /* @FT_LOAD_XXX constants can be used to control the */ 2417 /* glyph loading process (e.g., whether the outline */ 2418 /* should be scaled, whether to load bitmaps or not, */ 2419 /* whether to hint the outline, etc). */ 2420 /* */ 2421 /* <Return> */ 2422 /* FreeType error code. 0~means success. */ 2423 /* */ 2424 /* <Note> */ 2425 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ 2426 /* */ 2427 FT_EXPORT( FT_Error ) 2428 FT_Load_Char( FT_Face face, 2429 FT_ULong char_code, 2430 FT_Int32 load_flags ); 2431 2432 2433 /************************************************************************* 2434 * 2435 * @enum: 2436 * FT_LOAD_XXX 2437 * 2438 * @description: 2439 * A list of bit-field constants used with @FT_Load_Glyph to indicate 2440 * what kind of operations to perform during glyph loading. 2441 * 2442 * @values: 2443 * FT_LOAD_DEFAULT :: 2444 * Corresponding to~0, this value is used as the default glyph load 2445 * operation. In this case, the following happens: 2446 * 2447 * 1. FreeType looks for a bitmap for the glyph corresponding to the 2448 * face's current size. If one is found, the function returns. 2449 * The bitmap data can be accessed from the glyph slot (see note 2450 * below). 2451 * 2452 * 2. If no embedded bitmap is searched or found, FreeType looks for a 2453 * scalable outline. If one is found, it is loaded from the font 2454 * file, scaled to device pixels, then `hinted' to the pixel grid 2455 * in order to optimize it. The outline data can be accessed from 2456 * the glyph slot (see note below). 2457 * 2458 * Note that by default, the glyph loader doesn't render outlines into 2459 * bitmaps. The following flags are used to modify this default 2460 * behaviour to more specific and useful cases. 2461 * 2462 * FT_LOAD_NO_SCALE :: 2463 * Don't scale the loaded outline glyph but keep it in font units. 2464 * 2465 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and 2466 * unsets @FT_LOAD_RENDER. 2467 * 2468 * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using 2469 * FT_LOAD_NO_SCALE usually yields meaningless outlines because the 2470 * subglyphs must be scaled and positioned with hinting instructions. 2471 * This can be solved by loading the font without FT_LOAD_NO_SCALE and 2472 * setting the character size to `font->units_per_EM'. 2473 * 2474 * FT_LOAD_NO_HINTING :: 2475 * Disable hinting. This generally generates `blurrier' bitmap glyphs 2476 * when the glyph are rendered in any of the anti-aliased modes. See 2477 * also the note below. 2478 * 2479 * This flag is implied by @FT_LOAD_NO_SCALE. 2480 * 2481 * FT_LOAD_RENDER :: 2482 * Call @FT_Render_Glyph after the glyph is loaded. By default, the 2483 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be 2484 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. 2485 * 2486 * This flag is unset by @FT_LOAD_NO_SCALE. 2487 * 2488 * FT_LOAD_NO_BITMAP :: 2489 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this 2490 * flag. 2491 * 2492 * @FT_LOAD_NO_SCALE always sets this flag. 2493 * 2494 * FT_LOAD_VERTICAL_LAYOUT :: 2495 * Load the glyph for vertical text layout. In particular, the 2496 * `advance' value in the @FT_GlyphSlotRec structure is set to the 2497 * `vertAdvance' value of the `metrics' field. 2498 * 2499 * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use 2500 * this flag currently. Reason is that in this case vertical metrics 2501 * get synthesized, and those values are not always consistent across 2502 * various font formats. 2503 * 2504 * FT_LOAD_FORCE_AUTOHINT :: 2505 * Indicates that the auto-hinter is preferred over the font's native 2506 * hinter. See also the note below. 2507 * 2508 * FT_LOAD_CROP_BITMAP :: 2509 * Indicates that the font driver should crop the loaded bitmap glyph 2510 * (i.e., remove all space around its black bits). Not all drivers 2511 * implement this. 2512 * 2513 * FT_LOAD_PEDANTIC :: 2514 * Indicates that the font driver should perform pedantic verifications 2515 * during glyph loading. This is mostly used to detect broken glyphs 2516 * in fonts. By default, FreeType tries to handle broken fonts also. 2517 * 2518 * In particular, errors from the TrueType bytecode engine are not 2519 * passed to the application if this flag is not set; this might 2520 * result in partially hinted or distorted glyphs in case a glyph's 2521 * bytecode is buggy. 2522 * 2523 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: 2524 * Ignored. Deprecated. 2525 * 2526 * FT_LOAD_NO_RECURSE :: 2527 * This flag is only used internally. It merely indicates that the 2528 * font driver should not load composite glyphs recursively. Instead, 2529 * it should set the `num_subglyph' and `subglyphs' values of the 2530 * glyph slot accordingly, and set `glyph->format' to 2531 * @FT_GLYPH_FORMAT_COMPOSITE. 2532 * 2533 * The description of sub-glyphs is not available to client 2534 * applications for now. 2535 * 2536 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. 2537 * 2538 * FT_LOAD_IGNORE_TRANSFORM :: 2539 * Indicates that the transform matrix set by @FT_Set_Transform should 2540 * be ignored. 2541 * 2542 * FT_LOAD_MONOCHROME :: 2543 * This flag is used with @FT_LOAD_RENDER to indicate that you want to 2544 * render an outline glyph to a 1-bit monochrome bitmap glyph, with 2545 * 8~pixels packed into each byte of the bitmap data. 2546 * 2547 * Note that this has no effect on the hinting algorithm used. You 2548 * should rather use @FT_LOAD_TARGET_MONO so that the 2549 * monochrome-optimized hinting algorithm is used. 2550 * 2551 * FT_LOAD_LINEAR_DESIGN :: 2552 * Indicates that the `linearHoriAdvance' and `linearVertAdvance' 2553 * fields of @FT_GlyphSlotRec should be kept in font units. See 2554 * @FT_GlyphSlotRec for details. 2555 * 2556 * FT_LOAD_NO_AUTOHINT :: 2557 * Disable auto-hinter. See also the note below. 2558 * 2559 * FT_LOAD_COLOR :: 2560 * This flag is used to request loading of color embedded-bitmap 2561 * images. The resulting color bitmaps, if available, will have the 2562 * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color 2563 * bitmaps are found, they will be converted to 256-level gray 2564 * bitmaps transparently. Those bitmaps will be in the 2565 * @FT_PIXEL_MODE_GRAY format. 2566 * 2567 * @note: 2568 * By default, hinting is enabled and the font's native hinter (see 2569 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can 2570 * disable hinting by setting @FT_LOAD_NO_HINTING or change the 2571 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set 2572 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be 2573 * used at all. 2574 * 2575 * See the description of @FT_FACE_FLAG_TRICKY for a special exception 2576 * (affecting only a handful of Asian fonts). 2577 * 2578 * Besides deciding which hinter to use, you can also decide which 2579 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. 2580 * 2581 * Note that the auto-hinter needs a valid Unicode cmap (either a native 2582 * one or synthesized by FreeType) for producing correct results. If a 2583 * font provides an incorrect mapping (for example, assigning the 2584 * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a 2585 * mathematical integral sign), the auto-hinter might produce useless 2586 * results. 2587 * 2588 */ 2589 #define FT_LOAD_DEFAULT 0x0 2590 #define FT_LOAD_NO_SCALE ( 1L << 0 ) 2591 #define FT_LOAD_NO_HINTING ( 1L << 1 ) 2592 #define FT_LOAD_RENDER ( 1L << 2 ) 2593 #define FT_LOAD_NO_BITMAP ( 1L << 3 ) 2594 #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) 2595 #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) 2596 #define FT_LOAD_CROP_BITMAP ( 1L << 6 ) 2597 #define FT_LOAD_PEDANTIC ( 1L << 7 ) 2598 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) 2599 #define FT_LOAD_NO_RECURSE ( 1L << 10 ) 2600 #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) 2601 #define FT_LOAD_MONOCHROME ( 1L << 12 ) 2602 #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) 2603 #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) 2604 /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ 2605 #define FT_LOAD_COLOR ( 1L << 20 ) 2606 2607 /* */ 2608 2609 /* used internally only by certain font drivers! */ 2610 #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) 2611 #define FT_LOAD_SBITS_ONLY ( 1L << 14 ) 2612 2613 2614 /************************************************************************** 2615 * 2616 * @enum: 2617 * FT_LOAD_TARGET_XXX 2618 * 2619 * @description: 2620 * A list of values that are used to select a specific hinting algorithm 2621 * to use by the hinter. You should OR one of these values to your 2622 * `load_flags' when calling @FT_Load_Glyph. 2623 * 2624 * Note that font's native hinters may ignore the hinting algorithm you 2625 * have specified (e.g., the TrueType bytecode interpreter). You can set 2626 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. 2627 * 2628 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it 2629 * always implies @FT_LOAD_FORCE_AUTOHINT. 2630 * 2631 * @values: 2632 * FT_LOAD_TARGET_NORMAL :: 2633 * This corresponds to the default hinting algorithm, optimized for 2634 * standard gray-level rendering. For monochrome output, use 2635 * @FT_LOAD_TARGET_MONO instead. 2636 * 2637 * FT_LOAD_TARGET_LIGHT :: 2638 * A lighter hinting algorithm for non-monochrome modes. Many 2639 * generated glyphs are more fuzzy but better resemble its original 2640 * shape. A bit like rendering on Mac OS~X. 2641 * 2642 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT. 2643 * 2644 * FT_LOAD_TARGET_MONO :: 2645 * Strong hinting algorithm that should only be used for monochrome 2646 * output. The result is probably unpleasant if the glyph is rendered 2647 * in non-monochrome modes. 2648 * 2649 * FT_LOAD_TARGET_LCD :: 2650 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally 2651 * decimated LCD displays. 2652 * 2653 * FT_LOAD_TARGET_LCD_V :: 2654 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically 2655 * decimated LCD displays. 2656 * 2657 * @note: 2658 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your 2659 * `load_flags'. They can't be ORed. 2660 * 2661 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the 2662 * corresponding mode (i.e., the mode that matches the used algorithm 2663 * best). An exeption is FT_LOAD_TARGET_MONO since it implies 2664 * @FT_LOAD_MONOCHROME. 2665 * 2666 * You can use a hinting algorithm that doesn't correspond to the same 2667 * rendering mode. As an example, it is possible to use the `light' 2668 * hinting algorithm and have the results rendered in horizontal LCD 2669 * pixel mode, with code like 2670 * 2671 * { 2672 * FT_Load_Glyph( face, glyph_index, 2673 * load_flags | FT_LOAD_TARGET_LIGHT ); 2674 * 2675 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); 2676 * } 2677 * 2678 */ 2679 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) 2680 2681 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) 2682 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) 2683 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) 2684 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) 2685 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) 2686 2687 2688 /************************************************************************** 2689 * 2690 * @macro: 2691 * FT_LOAD_TARGET_MODE 2692 * 2693 * @description: 2694 * Return the @FT_Render_Mode corresponding to a given 2695 * @FT_LOAD_TARGET_XXX value. 2696 * 2697 */ 2698 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) 2699 2700 2701 /*************************************************************************/ 2702 /* */ 2703 /* <Function> */ 2704 /* FT_Set_Transform */ 2705 /* */ 2706 /* <Description> */ 2707 /* A function used to set the transformation that is applied to glyph */ 2708 /* images when they are loaded into a glyph slot through */ 2709 /* @FT_Load_Glyph. */ 2710 /* */ 2711 /* <InOut> */ 2712 /* face :: A handle to the source face object. */ 2713 /* */ 2714 /* <Input> */ 2715 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */ 2716 /* the identity matrix. */ 2717 /* delta :: A pointer to the translation vector. Use~0 for the null */ 2718 /* vector. */ 2719 /* */ 2720 /* <Note> */ 2721 /* The transformation is only applied to scalable image formats after */ 2722 /* the glyph has been loaded. It means that hinting is unaltered by */ 2723 /* the transformation and is performed on the character size given in */ 2724 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ 2725 /* */ 2726 /* Note that this also transforms the `face.glyph.advance' field, but */ 2727 /* *not* the values in `face.glyph.metrics'. */ 2728 /* */ 2729 FT_EXPORT( void ) 2730 FT_Set_Transform( FT_Face face, 2731 FT_Matrix* matrix, 2732 FT_Vector* delta ); 2733 2734 2735 /*************************************************************************/ 2736 /* */ 2737 /* <Enum> */ 2738 /* FT_Render_Mode */ 2739 /* */ 2740 /* <Description> */ 2741 /* An enumeration type that lists the render modes supported by */ 2742 /* FreeType~2. Each mode corresponds to a specific type of scanline */ 2743 /* conversion performed on the outline. */ 2744 /* */ 2745 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ 2746 /* field in the @FT_GlyphSlotRec structure gives the format of the */ 2747 /* returned bitmap. */ 2748 /* */ 2749 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */ 2750 /* */ 2751 /* <Values> */ 2752 /* FT_RENDER_MODE_NORMAL :: */ 2753 /* This is the default render mode; it corresponds to 8-bit */ 2754 /* anti-aliased bitmaps. */ 2755 /* */ 2756 /* FT_RENDER_MODE_LIGHT :: */ 2757 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ 2758 /* defined as a separate value because render modes are also used */ 2759 /* indirectly to define hinting algorithm selectors. See */ 2760 /* @FT_LOAD_TARGET_XXX for details. */ 2761 /* */ 2762 /* FT_RENDER_MODE_MONO :: */ 2763 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ 2764 /* opacity). */ 2765 /* */ 2766 /* FT_RENDER_MODE_LCD :: */ 2767 /* This mode corresponds to horizontal RGB and BGR sub-pixel */ 2768 /* displays like LCD screens. It produces 8-bit bitmaps that are */ 2769 /* 3~times the width of the original glyph outline in pixels, and */ 2770 /* which use the @FT_PIXEL_MODE_LCD mode. */ 2771 /* */ 2772 /* FT_RENDER_MODE_LCD_V :: */ 2773 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ 2774 /* (like PDA screens, rotated LCD displays, etc.). It produces */ 2775 /* 8-bit bitmaps that are 3~times the height of the original */ 2776 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ 2777 /* */ 2778 /* <Note> */ 2779 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ 2780 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ 2781 /* (not active in the default builds). It is up to the caller to */ 2782 /* either call @FT_Library_SetLcdFilter (if available) or do the */ 2783 /* filtering itself. */ 2784 /* */ 2785 /* The selected render mode only affects vector glyphs of a font. */ 2786 /* Embedded bitmaps often have a different pixel mode like */ 2787 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ 2788 /* them into 8-bit pixmaps. */ 2789 /* */ 2790 typedef enum FT_Render_Mode_ 2791 { 2792 FT_RENDER_MODE_NORMAL = 0, 2793 FT_RENDER_MODE_LIGHT, 2794 FT_RENDER_MODE_MONO, 2795 FT_RENDER_MODE_LCD, 2796 FT_RENDER_MODE_LCD_V, 2797 2798 FT_RENDER_MODE_MAX 2799 2800 } FT_Render_Mode; 2801 2802 2803 /*************************************************************************/ 2804 /* */ 2805 /* <Enum> */ 2806 /* ft_render_mode_xxx */ 2807 /* */ 2808 /* <Description> */ 2809 /* These constants are deprecated. Use the corresponding */ 2810 /* @FT_Render_Mode values instead. */ 2811 /* */ 2812 /* <Values> */ 2813 /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ 2814 /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ 2815 /* */ 2816 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL 2817 #define ft_render_mode_mono FT_RENDER_MODE_MONO 2818 2819 2820 /*************************************************************************/ 2821 /* */ 2822 /* <Function> */ 2823 /* FT_Render_Glyph */ 2824 /* */ 2825 /* <Description> */ 2826 /* Convert a given glyph image to a bitmap. It does so by inspecting */ 2827 /* the glyph image format, finding the relevant renderer, and */ 2828 /* invoking it. */ 2829 /* */ 2830 /* <InOut> */ 2831 /* slot :: A handle to the glyph slot containing the image to */ 2832 /* convert. */ 2833 /* */ 2834 /* <Input> */ 2835 /* render_mode :: This is the render mode used to render the glyph */ 2836 /* image into a bitmap. See @FT_Render_Mode for a */ 2837 /* list of possible values. */ 2838 /* */ 2839 /* <Return> */ 2840 /* FreeType error code. 0~means success. */ 2841 /* */ 2842 FT_EXPORT( FT_Error ) 2843 FT_Render_Glyph( FT_GlyphSlot slot, 2844 FT_Render_Mode render_mode ); 2845 2846 2847 /*************************************************************************/ 2848 /* */ 2849 /* <Enum> */ 2850 /* FT_Kerning_Mode */ 2851 /* */ 2852 /* <Description> */ 2853 /* An enumeration used to specify which kerning values to return in */ 2854 /* @FT_Get_Kerning. */ 2855 /* */ 2856 /* <Values> */ 2857 /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ 2858 /* distances (value is~0). */ 2859 /* */ 2860 /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ 2861 /* distances. */ 2862 /* */ 2863 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ 2864 /* units. */ 2865 /* */ 2866 typedef enum FT_Kerning_Mode_ 2867 { 2868 FT_KERNING_DEFAULT = 0, 2869 FT_KERNING_UNFITTED, 2870 FT_KERNING_UNSCALED 2871 2872 } FT_Kerning_Mode; 2873 2874 2875 /*************************************************************************/ 2876 /* */ 2877 /* <Const> */ 2878 /* ft_kerning_default */ 2879 /* */ 2880 /* <Description> */ 2881 /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ 2882 /* instead. */ 2883 /* */ 2884 #define ft_kerning_default FT_KERNING_DEFAULT 2885 2886 2887 /*************************************************************************/ 2888 /* */ 2889 /* <Const> */ 2890 /* ft_kerning_unfitted */ 2891 /* */ 2892 /* <Description> */ 2893 /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ 2894 /* instead. */ 2895 /* */ 2896 #define ft_kerning_unfitted FT_KERNING_UNFITTED 2897 2898 2899 /*************************************************************************/ 2900 /* */ 2901 /* <Const> */ 2902 /* ft_kerning_unscaled */ 2903 /* */ 2904 /* <Description> */ 2905 /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ 2906 /* instead. */ 2907 /* */ 2908 #define ft_kerning_unscaled FT_KERNING_UNSCALED 2909 2910 2911 /*************************************************************************/ 2912 /* */ 2913 /* <Function> */ 2914 /* FT_Get_Kerning */ 2915 /* */ 2916 /* <Description> */ 2917 /* Return the kerning vector between two glyphs of a same face. */ 2918 /* */ 2919 /* <Input> */ 2920 /* face :: A handle to a source face object. */ 2921 /* */ 2922 /* left_glyph :: The index of the left glyph in the kern pair. */ 2923 /* */ 2924 /* right_glyph :: The index of the right glyph in the kern pair. */ 2925 /* */ 2926 /* kern_mode :: See @FT_Kerning_Mode for more information. */ 2927 /* Determines the scale and dimension of the returned */ 2928 /* kerning vector. */ 2929 /* */ 2930 /* <Output> */ 2931 /* akerning :: The kerning vector. This is either in font units */ 2932 /* or in pixels (26.6 format) for scalable formats, */ 2933 /* and in pixels for fixed-sizes formats. */ 2934 /* */ 2935 /* <Return> */ 2936 /* FreeType error code. 0~means success. */ 2937 /* */ 2938 /* <Note> */ 2939 /* Only horizontal layouts (left-to-right & right-to-left) are */ 2940 /* supported by this method. Other layouts, or more sophisticated */ 2941 /* kernings, are out of the scope of this API function -- they can be */ 2942 /* implemented through format-specific interfaces. */ 2943 /* */ 2944 FT_EXPORT( FT_Error ) 2945 FT_Get_Kerning( FT_Face face, 2946 FT_UInt left_glyph, 2947 FT_UInt right_glyph, 2948 FT_UInt kern_mode, 2949 FT_Vector *akerning ); 2950 2951 2952 /*************************************************************************/ 2953 /* */ 2954 /* <Function> */ 2955 /* FT_Get_Track_Kerning */ 2956 /* */ 2957 /* <Description> */ 2958 /* Return the track kerning for a given face object at a given size. */ 2959 /* */ 2960 /* <Input> */ 2961 /* face :: A handle to a source face object. */ 2962 /* */ 2963 /* point_size :: The point size in 16.16 fractional points. */ 2964 /* */ 2965 /* degree :: The degree of tightness. Increasingly negative */ 2966 /* values represent tighter track kerning, while */ 2967 /* increasingly positive values represent looser track */ 2968 /* kerning. Value zero means no track kerning. */ 2969 /* */ 2970 /* <Output> */ 2971 /* akerning :: The kerning in 16.16 fractional points, to be */ 2972 /* uniformly applied between all glyphs. */ 2973 /* */ 2974 /* <Return> */ 2975 /* FreeType error code. 0~means success. */ 2976 /* */ 2977 /* <Note> */ 2978 /* Currently, only the Type~1 font driver supports track kerning, */ 2979 /* using data from AFM files (if attached with @FT_Attach_File or */ 2980 /* @FT_Attach_Stream). */ 2981 /* */ 2982 /* Only very few AFM files come with track kerning data; please refer */ 2983 /* to the Adobe's AFM specification for more details. */ 2984 /* */ 2985 FT_EXPORT( FT_Error ) 2986 FT_Get_Track_Kerning( FT_Face face, 2987 FT_Fixed point_size, 2988 FT_Int degree, 2989 FT_Fixed* akerning ); 2990 2991 2992 /*************************************************************************/ 2993 /* */ 2994 /* <Function> */ 2995 /* FT_Get_Glyph_Name */ 2996 /* */ 2997 /* <Description> */ 2998 /* Retrieve the ASCII name of a given glyph in a face. This only */ 2999 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ 3000 /* */ 3001 /* <Input> */ 3002 /* face :: A handle to a source face object. */ 3003 /* */ 3004 /* glyph_index :: The glyph index. */ 3005 /* */ 3006 /* buffer_max :: The maximum number of bytes available in the */ 3007 /* buffer. */ 3008 /* */ 3009 /* <Output> */ 3010 /* buffer :: A pointer to a target buffer where the name is */ 3011 /* copied to. */ 3012 /* */ 3013 /* <Return> */ 3014 /* FreeType error code. 0~means success. */ 3015 /* */ 3016 /* <Note> */ 3017 /* An error is returned if the face doesn't provide glyph names or if */ 3018 /* the glyph index is invalid. In all cases of failure, the first */ 3019 /* byte of `buffer' is set to~0 to indicate an empty name. */ 3020 /* */ 3021 /* The glyph name is truncated to fit within the buffer if it is too */ 3022 /* long. The returned string is always zero-terminated. */ 3023 /* */ 3024 /* Be aware that FreeType reorders glyph indices internally so that */ 3025 /* glyph index~0 always corresponds to the `missing glyph' (called */ 3026 /* `.notdef'). */ 3027 /* */ 3028 /* This function is not compiled within the library if the config */ 3029 /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ 3030 /* `ftoptions.h'. */ 3031 /* */ 3032 FT_EXPORT( FT_Error ) 3033 FT_Get_Glyph_Name( FT_Face face, 3034 FT_UInt glyph_index, 3035 FT_Pointer buffer, 3036 FT_UInt buffer_max ); 3037 3038 3039 /*************************************************************************/ 3040 /* */ 3041 /* <Function> */ 3042 /* FT_Get_Postscript_Name */ 3043 /* */ 3044 /* <Description> */ 3045 /* Retrieve the ASCII PostScript name of a given face, if available. */ 3046 /* This only works with PostScript and TrueType fonts. */ 3047 /* */ 3048 /* <Input> */ 3049 /* face :: A handle to the source face object. */ 3050 /* */ 3051 /* <Return> */ 3052 /* A pointer to the face's PostScript name. NULL if unavailable. */ 3053 /* */ 3054 /* <Note> */ 3055 /* The returned pointer is owned by the face and is destroyed with */ 3056 /* it. */ 3057 /* */ 3058 FT_EXPORT( const char* ) 3059 FT_Get_Postscript_Name( FT_Face face ); 3060 3061 3062 /*************************************************************************/ 3063 /* */ 3064 /* <Function> */ 3065 /* FT_Select_Charmap */ 3066 /* */ 3067 /* <Description> */ 3068 /* Select a given charmap by its encoding tag (as listed in */ 3069 /* `freetype.h'). */ 3070 /* */ 3071 /* <InOut> */ 3072 /* face :: A handle to the source face object. */ 3073 /* */ 3074 /* <Input> */ 3075 /* encoding :: A handle to the selected encoding. */ 3076 /* */ 3077 /* <Return> */ 3078 /* FreeType error code. 0~means success. */ 3079 /* */ 3080 /* <Note> */ 3081 /* This function returns an error if no charmap in the face */ 3082 /* corresponds to the encoding queried here. */ 3083 /* */ 3084 /* Because many fonts contain more than a single cmap for Unicode */ 3085 /* encoding, this function has some special code to select the one */ 3086 /* that covers Unicode best (`best' in the sense that a UCS-4 cmap is */ 3087 /* preferred to a UCS-2 cmap). It is thus preferable to */ 3088 /* @FT_Set_Charmap in this case. */ 3089 /* */ 3090 FT_EXPORT( FT_Error ) 3091 FT_Select_Charmap( FT_Face face, 3092 FT_Encoding encoding ); 3093 3094 3095 /*************************************************************************/ 3096 /* */ 3097 /* <Function> */ 3098 /* FT_Set_Charmap */ 3099 /* */ 3100 /* <Description> */ 3101 /* Select a given charmap for character code to glyph index mapping. */ 3102 /* */ 3103 /* <InOut> */ 3104 /* face :: A handle to the source face object. */ 3105 /* */ 3106 /* <Input> */ 3107 /* charmap :: A handle to the selected charmap. */ 3108 /* */ 3109 /* <Return> */ 3110 /* FreeType error code. 0~means success. */ 3111 /* */ 3112 /* <Note> */ 3113 /* This function returns an error if the charmap is not part of */ 3114 /* the face (i.e., if it is not listed in the `face->charmaps' */ 3115 /* table). */ 3116 /* */ 3117 /* It also fails if a type~14 charmap is selected. */ 3118 /* */ 3119 FT_EXPORT( FT_Error ) 3120 FT_Set_Charmap( FT_Face face, 3121 FT_CharMap charmap ); 3122 3123 3124 /************************************************************************* 3125 * 3126 * @function: 3127 * FT_Get_Charmap_Index 3128 * 3129 * @description: 3130 * Retrieve index of a given charmap. 3131 * 3132 * @input: 3133 * charmap :: 3134 * A handle to a charmap. 3135 * 3136 * @return: 3137 * The index into the array of character maps within the face to which 3138 * `charmap' belongs. If an error occurs, -1 is returned. 3139 * 3140 */ 3141 FT_EXPORT( FT_Int ) 3142 FT_Get_Charmap_Index( FT_CharMap charmap ); 3143 3144 3145 /*************************************************************************/ 3146 /* */ 3147 /* <Function> */ 3148 /* FT_Get_Char_Index */ 3149 /* */ 3150 /* <Description> */ 3151 /* Return the glyph index of a given character code. This function */ 3152 /* uses a charmap object to do the mapping. */ 3153 /* */ 3154 /* <Input> */ 3155 /* face :: A handle to the source face object. */ 3156 /* */ 3157 /* charcode :: The character code. */ 3158 /* */ 3159 /* <Return> */ 3160 /* The glyph index. 0~means `undefined character code'. */ 3161 /* */ 3162 /* <Note> */ 3163 /* If you use FreeType to manipulate the contents of font files */ 3164 /* directly, be aware that the glyph index returned by this function */ 3165 /* doesn't always correspond to the internal indices used within the */ 3166 /* file. This is done to ensure that value~0 always corresponds to */ 3167 /* the `missing glyph'. If the first glyph is not named `.notdef', */ 3168 /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ 3169 /* the glyph ID~0 position, and whatever was there will be moved to */ 3170 /* the position `.notdef' had. For Type~1 fonts, if there is no */ 3171 /* `.notdef' glyph at all, then one will be created at index~0 and */ 3172 /* whatever was there will be moved to the last index -- Type~42 */ 3173 /* fonts are considered invalid under this condition. */ 3174 /* */ 3175 FT_EXPORT( FT_UInt ) 3176 FT_Get_Char_Index( FT_Face face, 3177 FT_ULong charcode ); 3178 3179 3180 /*************************************************************************/ 3181 /* */ 3182 /* <Function> */ 3183 /* FT_Get_First_Char */ 3184 /* */ 3185 /* <Description> */ 3186 /* This function is used to return the first character code in the */ 3187 /* current charmap of a given face. It also returns the */ 3188 /* corresponding glyph index. */ 3189 /* */ 3190 /* <Input> */ 3191 /* face :: A handle to the source face object. */ 3192 /* */ 3193 /* <Output> */ 3194 /* agindex :: Glyph index of first character code. 0~if charmap is */ 3195 /* empty. */ 3196 /* */ 3197 /* <Return> */ 3198 /* The charmap's first character code. */ 3199 /* */ 3200 /* <Note> */ 3201 /* You should use this function with @FT_Get_Next_Char to be able to */ 3202 /* parse all character codes available in a given charmap. The code */ 3203 /* should look like this: */ 3204 /* */ 3205 /* { */ 3206 /* FT_ULong charcode; */ 3207 /* FT_UInt gindex; */ 3208 /* */ 3209 /* */ 3210 /* charcode = FT_Get_First_Char( face, &gindex ); */ 3211 /* while ( gindex != 0 ) */ 3212 /* { */ 3213 /* ... do something with (charcode,gindex) pair ... */ 3214 /* */ 3215 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ 3216 /* } */ 3217 /* } */ 3218 /* */ 3219 /* Note that `*agindex' is set to~0 if the charmap is empty. The */ 3220 /* result itself can be~0 in two cases: if the charmap is empty or */ 3221 /* if the value~0 is the first valid character code. */ 3222 /* */ 3223 FT_EXPORT( FT_ULong ) 3224 FT_Get_First_Char( FT_Face face, 3225 FT_UInt *agindex ); 3226 3227 3228 /*************************************************************************/ 3229 /* */ 3230 /* <Function> */ 3231 /* FT_Get_Next_Char */ 3232 /* */ 3233 /* <Description> */ 3234 /* This function is used to return the next character code in the */ 3235 /* current charmap of a given face following the value `char_code', */ 3236 /* as well as the corresponding glyph index. */ 3237 /* */ 3238 /* <Input> */ 3239 /* face :: A handle to the source face object. */ 3240 /* char_code :: The starting character code. */ 3241 /* */ 3242 /* <Output> */ 3243 /* agindex :: Glyph index of next character code. 0~if charmap */ 3244 /* is empty. */ 3245 /* */ 3246 /* <Return> */ 3247 /* The charmap's next character code. */ 3248 /* */ 3249 /* <Note> */ 3250 /* You should use this function with @FT_Get_First_Char to walk */ 3251 /* over all character codes available in a given charmap. See the */ 3252 /* note for this function for a simple code example. */ 3253 /* */ 3254 /* Note that `*agindex' is set to~0 when there are no more codes in */ 3255 /* the charmap. */ 3256 /* */ 3257 FT_EXPORT( FT_ULong ) 3258 FT_Get_Next_Char( FT_Face face, 3259 FT_ULong char_code, 3260 FT_UInt *agindex ); 3261 3262 3263 /*************************************************************************/ 3264 /* */ 3265 /* <Function> */ 3266 /* FT_Get_Name_Index */ 3267 /* */ 3268 /* <Description> */ 3269 /* Return the glyph index of a given glyph name. This function uses */ 3270 /* driver specific objects to do the translation. */ 3271 /* */ 3272 /* <Input> */ 3273 /* face :: A handle to the source face object. */ 3274 /* */ 3275 /* glyph_name :: The glyph name. */ 3276 /* */ 3277 /* <Return> */ 3278 /* The glyph index. 0~means `undefined character code'. */ 3279 /* */ 3280 FT_EXPORT( FT_UInt ) 3281 FT_Get_Name_Index( FT_Face face, 3282 FT_String* glyph_name ); 3283 3284 3285 /************************************************************************* 3286 * 3287 * @macro: 3288 * FT_SUBGLYPH_FLAG_XXX 3289 * 3290 * @description: 3291 * A list of constants used to describe subglyphs. Please refer to the 3292 * TrueType specification for the meaning of the various flags. 3293 * 3294 * @values: 3295 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: 3296 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: 3297 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: 3298 * FT_SUBGLYPH_FLAG_SCALE :: 3299 * FT_SUBGLYPH_FLAG_XY_SCALE :: 3300 * FT_SUBGLYPH_FLAG_2X2 :: 3301 * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: 3302 * 3303 */ 3304 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 3305 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 3306 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 3307 #define FT_SUBGLYPH_FLAG_SCALE 8 3308 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 3309 #define FT_SUBGLYPH_FLAG_2X2 0x80 3310 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 3311 3312 3313 /************************************************************************* 3314 * 3315 * @func: 3316 * FT_Get_SubGlyph_Info 3317 * 3318 * @description: 3319 * Retrieve a description of a given subglyph. Only use it if 3320 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is 3321 * returned otherwise. 3322 * 3323 * @input: 3324 * glyph :: 3325 * The source glyph slot. 3326 * 3327 * sub_index :: 3328 * The index of the subglyph. Must be less than 3329 * `glyph->num_subglyphs'. 3330 * 3331 * @output: 3332 * p_index :: 3333 * The glyph index of the subglyph. 3334 * 3335 * p_flags :: 3336 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. 3337 * 3338 * p_arg1 :: 3339 * The subglyph's first argument (if any). 3340 * 3341 * p_arg2 :: 3342 * The subglyph's second argument (if any). 3343 * 3344 * p_transform :: 3345 * The subglyph transformation (if any). 3346 * 3347 * @return: 3348 * FreeType error code. 0~means success. 3349 * 3350 * @note: 3351 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be 3352 * interpreted depending on the flags returned in `*p_flags'. See the 3353 * TrueType specification for details. 3354 * 3355 */ 3356 FT_EXPORT( FT_Error ) 3357 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, 3358 FT_UInt sub_index, 3359 FT_Int *p_index, 3360 FT_UInt *p_flags, 3361 FT_Int *p_arg1, 3362 FT_Int *p_arg2, 3363 FT_Matrix *p_transform ); 3364 3365 3366 /*************************************************************************/ 3367 /* */ 3368 /* <Enum> */ 3369 /* FT_FSTYPE_XXX */ 3370 /* */ 3371 /* <Description> */ 3372 /* A list of bit flags used in the `fsType' field of the OS/2 table */ 3373 /* in a TrueType or OpenType font and the `FSType' entry in a */ 3374 /* PostScript font. These bit flags are returned by */ 3375 /* @FT_Get_FSType_Flags; they inform client applications of embedding */ 3376 /* and subsetting restrictions associated with a font. */ 3377 /* */ 3378 /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ 3379 /* more details. */ 3380 /* */ 3381 /* <Values> */ 3382 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ 3383 /* Fonts with no fsType bit set may be embedded and permanently */ 3384 /* installed on the remote system by an application. */ 3385 /* */ 3386 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ 3387 /* Fonts that have only this bit set must not be modified, embedded */ 3388 /* or exchanged in any manner without first obtaining permission of */ 3389 /* the font software copyright owner. */ 3390 /* */ 3391 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ 3392 /* If this bit is set, the font may be embedded and temporarily */ 3393 /* loaded on the remote system. Documents containing Preview & */ 3394 /* Print fonts must be opened `read-only'; no edits can be applied */ 3395 /* to the document. */ 3396 /* */ 3397 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */ 3398 /* If this bit is set, the font may be embedded but must only be */ 3399 /* installed temporarily on other systems. In contrast to Preview */ 3400 /* & Print fonts, documents containing editable fonts may be opened */ 3401 /* for reading, editing is permitted, and changes may be saved. */ 3402 /* */ 3403 /* FT_FSTYPE_NO_SUBSETTING :: */ 3404 /* If this bit is set, the font may not be subsetted prior to */ 3405 /* embedding. */ 3406 /* */ 3407 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ 3408 /* If this bit is set, only bitmaps contained in the font may be */ 3409 /* embedded; no outline data may be embedded. If there are no */ 3410 /* bitmaps available in the font, then the font is unembeddable. */ 3411 /* */ 3412 /* <Note> */ 3413 /* While the fsType flags can indicate that a font may be embedded, a */ 3414 /* license with the font vendor may be separately required to use the */ 3415 /* font in this way. */ 3416 /* */ 3417 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 3418 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 3419 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 3420 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 3421 #define FT_FSTYPE_NO_SUBSETTING 0x0100 3422 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 3423 3424 3425 /*************************************************************************/ 3426 /* */ 3427 /* <Function> */ 3428 /* FT_Get_FSType_Flags */ 3429 /* */ 3430 /* <Description> */ 3431 /* Return the fsType flags for a font. */ 3432 /* */ 3433 /* <Input> */ 3434 /* face :: A handle to the source face object. */ 3435 /* */ 3436 /* <Return> */ 3437 /* The fsType flags, @FT_FSTYPE_XXX. */ 3438 /* */ 3439 /* <Note> */ 3440 /* Use this function rather than directly reading the `fs_type' field */ 3441 /* in the @PS_FontInfoRec structure, which is only guaranteed to */ 3442 /* return the correct results for Type~1 fonts. */ 3443 /* */ 3444 /* <Since> */ 3445 /* 2.3.8 */ 3446 /* */ 3447 FT_EXPORT( FT_UShort ) 3448 FT_Get_FSType_Flags( FT_Face face ); 3449 3450 3451 /*************************************************************************/ 3452 /* */ 3453 /* <Section> */ 3454 /* glyph_variants */ 3455 /* */ 3456 /* <Title> */ 3457 /* Glyph Variants */ 3458 /* */ 3459 /* <Abstract> */ 3460 /* The FreeType~2 interface to Unicode Ideographic Variation */ 3461 /* Sequences (IVS), using the SFNT cmap format~14. */ 3462 /* */ 3463 /* <Description> */ 3464 /* Many CJK characters have variant forms. They are a sort of grey */ 3465 /* area somewhere between being totally irrelevant and semantically */ 3466 /* distinct; for this reason, the Unicode consortium decided to */ 3467 /* introduce Ideographic Variation Sequences (IVS), consisting of a */ 3468 /* Unicode base character and one of 240 variant selectors */ 3469 /* (U+E0100-U+E01EF), instead of further extending the already huge */ 3470 /* code range for CJK characters. */ 3471 /* */ 3472 /* An IVS is registered and unique; for further details please refer */ 3473 /* to Unicode Technical Standard #37, the Ideographic Variation */ 3474 /* Database: */ 3475 /* */ 3476 /* http://www.unicode.org/reports/tr37/ */ 3477 /* */ 3478 /* To date (November 2012), the character with the most variants is */ 3479 /* U+9089, having 31 such IVS. */ 3480 /* */ 3481 /* Adobe and MS decided to support IVS with a new cmap subtable */ 3482 /* (format~14). It is an odd subtable because it is not a mapping of */ 3483 /* input code points to glyphs, but contains lists of all variants */ 3484 /* supported by the font. */ 3485 /* */ 3486 /* A variant may be either `default' or `non-default'. A default */ 3487 /* variant is the one you will get for that code point if you look it */ 3488 /* up in the standard Unicode cmap. A non-default variant is a */ 3489 /* different glyph. */ 3490 /* */ 3491 /*************************************************************************/ 3492 3493 3494 /*************************************************************************/ 3495 /* */ 3496 /* <Function> */ 3497 /* FT_Face_GetCharVariantIndex */ 3498 /* */ 3499 /* <Description> */ 3500 /* Return the glyph index of a given character code as modified by */ 3501 /* the variation selector. */ 3502 /* */ 3503 /* <Input> */ 3504 /* face :: */ 3505 /* A handle to the source face object. */ 3506 /* */ 3507 /* charcode :: */ 3508 /* The character code point in Unicode. */ 3509 /* */ 3510 /* variantSelector :: */ 3511 /* The Unicode code point of the variation selector. */ 3512 /* */ 3513 /* <Return> */ 3514 /* The glyph index. 0~means either `undefined character code', or */ 3515 /* `undefined selector code', or `no variation selector cmap */ 3516 /* subtable', or `current CharMap is not Unicode'. */ 3517 /* */ 3518 /* <Note> */ 3519 /* If you use FreeType to manipulate the contents of font files */ 3520 /* directly, be aware that the glyph index returned by this function */ 3521 /* doesn't always correspond to the internal indices used within */ 3522 /* the file. This is done to ensure that value~0 always corresponds */ 3523 /* to the `missing glyph'. */ 3524 /* */ 3525 /* This function is only meaningful if */ 3526 /* a) the font has a variation selector cmap sub table, */ 3527 /* and */ 3528 /* b) the current charmap has a Unicode encoding. */ 3529 /* */ 3530 /* <Since> */ 3531 /* 2.3.6 */ 3532 /* */ 3533 FT_EXPORT( FT_UInt ) 3534 FT_Face_GetCharVariantIndex( FT_Face face, 3535 FT_ULong charcode, 3536 FT_ULong variantSelector ); 3537 3538 3539 /*************************************************************************/ 3540 /* */ 3541 /* <Function> */ 3542 /* FT_Face_GetCharVariantIsDefault */ 3543 /* */ 3544 /* <Description> */ 3545 /* Check whether this variant of this Unicode character is the one to */ 3546 /* be found in the `cmap'. */ 3547 /* */ 3548 /* <Input> */ 3549 /* face :: */ 3550 /* A handle to the source face object. */ 3551 /* */ 3552 /* charcode :: */ 3553 /* The character codepoint in Unicode. */ 3554 /* */ 3555 /* variantSelector :: */ 3556 /* The Unicode codepoint of the variation selector. */ 3557 /* */ 3558 /* <Return> */ 3559 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */ 3560 /* variation selector cmap, or -1 if it is not a variant. */ 3561 /* */ 3562 /* <Note> */ 3563 /* This function is only meaningful if the font has a variation */ 3564 /* selector cmap subtable. */ 3565 /* */ 3566 /* <Since> */ 3567 /* 2.3.6 */ 3568 /* */ 3569 FT_EXPORT( FT_Int ) 3570 FT_Face_GetCharVariantIsDefault( FT_Face face, 3571 FT_ULong charcode, 3572 FT_ULong variantSelector ); 3573 3574 3575 /*************************************************************************/ 3576 /* */ 3577 /* <Function> */ 3578 /* FT_Face_GetVariantSelectors */ 3579 /* */ 3580 /* <Description> */ 3581 /* Return a zero-terminated list of Unicode variant selectors found */ 3582 /* in the font. */ 3583 /* */ 3584 /* <Input> */ 3585 /* face :: */ 3586 /* A handle to the source face object. */ 3587 /* */ 3588 /* <Return> */ 3589 /* A pointer to an array of selector code points, or NULL if there is */ 3590 /* no valid variant selector cmap subtable. */ 3591 /* */ 3592 /* <Note> */ 3593 /* The last item in the array is~0; the array is owned by the */ 3594 /* @FT_Face object but can be overwritten or released on the next */ 3595 /* call to a FreeType function. */ 3596 /* */ 3597 /* <Since> */ 3598 /* 2.3.6 */ 3599 /* */ 3600 FT_EXPORT( FT_UInt32* ) 3601 FT_Face_GetVariantSelectors( FT_Face face ); 3602 3603 3604 /*************************************************************************/ 3605 /* */ 3606 /* <Function> */ 3607 /* FT_Face_GetVariantsOfChar */ 3608 /* */ 3609 /* <Description> */ 3610 /* Return a zero-terminated list of Unicode variant selectors found */ 3611 /* for the specified character code. */ 3612 /* */ 3613 /* <Input> */ 3614 /* face :: */ 3615 /* A handle to the source face object. */ 3616 /* */ 3617 /* charcode :: */ 3618 /* The character codepoint in Unicode. */ 3619 /* */ 3620 /* <Return> */ 3621 /* A pointer to an array of variant selector code points that are */ 3622 /* active for the given character, or NULL if the corresponding list */ 3623 /* is empty. */ 3624 /* */ 3625 /* <Note> */ 3626 /* The last item in the array is~0; the array is owned by the */ 3627 /* @FT_Face object but can be overwritten or released on the next */ 3628 /* call to a FreeType function. */ 3629 /* */ 3630 /* <Since> */ 3631 /* 2.3.6 */ 3632 /* */ 3633 FT_EXPORT( FT_UInt32* ) 3634 FT_Face_GetVariantsOfChar( FT_Face face, 3635 FT_ULong charcode ); 3636 3637 3638 /*************************************************************************/ 3639 /* */ 3640 /* <Function> */ 3641 /* FT_Face_GetCharsOfVariant */ 3642 /* */ 3643 /* <Description> */ 3644 /* Return a zero-terminated list of Unicode character codes found for */ 3645 /* the specified variant selector. */ 3646 /* */ 3647 /* <Input> */ 3648 /* face :: */ 3649 /* A handle to the source face object. */ 3650 /* */ 3651 /* variantSelector :: */ 3652 /* The variant selector code point in Unicode. */ 3653 /* */ 3654 /* <Return> */ 3655 /* A list of all the code points that are specified by this selector */ 3656 /* (both default and non-default codes are returned) or NULL if there */ 3657 /* is no valid cmap or the variant selector is invalid. */ 3658 /* */ 3659 /* <Note> */ 3660 /* The last item in the array is~0; the array is owned by the */ 3661 /* @FT_Face object but can be overwritten or released on the next */ 3662 /* call to a FreeType function. */ 3663 /* */ 3664 /* <Since> */ 3665 /* 2.3.6 */ 3666 /* */ 3667 FT_EXPORT( FT_UInt32* ) 3668 FT_Face_GetCharsOfVariant( FT_Face face, 3669 FT_ULong variantSelector ); 3670 3671 3672 /*************************************************************************/ 3673 /* */ 3674 /* <Section> */ 3675 /* computations */ 3676 /* */ 3677 /* <Title> */ 3678 /* Computations */ 3679 /* */ 3680 /* <Abstract> */ 3681 /* Crunching fixed numbers and vectors. */ 3682 /* */ 3683 /* <Description> */ 3684 /* This section contains various functions used to perform */ 3685 /* computations on 16.16 fixed-float numbers or 2d vectors. */ 3686 /* */ 3687 /* <Order> */ 3688 /* FT_MulDiv */ 3689 /* FT_MulFix */ 3690 /* FT_DivFix */ 3691 /* FT_RoundFix */ 3692 /* FT_CeilFix */ 3693 /* FT_FloorFix */ 3694 /* FT_Vector_Transform */ 3695 /* FT_Matrix_Multiply */ 3696 /* FT_Matrix_Invert */ 3697 /* */ 3698 /*************************************************************************/ 3699 3700 3701 /*************************************************************************/ 3702 /* */ 3703 /* <Function> */ 3704 /* FT_MulDiv */ 3705 /* */ 3706 /* <Description> */ 3707 /* A very simple function used to perform the computation `(a*b)/c' */ 3708 /* with maximum accuracy (it uses a 64-bit intermediate integer */ 3709 /* whenever necessary). */ 3710 /* */ 3711 /* This function isn't necessarily as fast as some processor specific */ 3712 /* operations, but is at least completely portable. */ 3713 /* */ 3714 /* <Input> */ 3715 /* a :: The first multiplier. */ 3716 /* b :: The second multiplier. */ 3717 /* c :: The divisor. */ 3718 /* */ 3719 /* <Return> */ 3720 /* The result of `(a*b)/c'. This function never traps when trying to */ 3721 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ 3722 /* on the signs of `a' and `b'. */ 3723 /* */ 3724 FT_EXPORT( FT_Long ) 3725 FT_MulDiv( FT_Long a, 3726 FT_Long b, 3727 FT_Long c ); 3728 3729 3730 /* */ 3731 3732 /* The following #if 0 ... #endif is for the documentation formatter, */ 3733 /* hiding the internal `FT_MULFIX_INLINED' macro. */ 3734 3735 #if 0 3736 /*************************************************************************/ 3737 /* */ 3738 /* <Function> */ 3739 /* FT_MulFix */ 3740 /* */ 3741 /* <Description> */ 3742 /* A very simple function used to perform the computation */ 3743 /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ 3744 /* used to multiply a given value by a 16.16 fixed-point factor. */ 3745 /* */ 3746 /* <Input> */ 3747 /* a :: The first multiplier. */ 3748 /* b :: The second multiplier. Use a 16.16 factor here whenever */ 3749 /* possible (see note below). */ 3750 /* */ 3751 /* <Return> */ 3752 /* The result of `(a*b)/0x10000'. */ 3753 /* */ 3754 /* <Note> */ 3755 /* This function has been optimized for the case where the absolute */ 3756 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ 3757 /* As this happens mainly when scaling from notional units to */ 3758 /* fractional pixels in FreeType, it resulted in noticeable speed */ 3759 /* improvements between versions 2.x and 1.x. */ 3760 /* */ 3761 /* As a conclusion, always try to place a 16.16 factor as the */ 3762 /* _second_ argument of this function; this can make a great */ 3763 /* difference. */ 3764 /* */ 3765 FT_EXPORT( FT_Long ) 3766 FT_MulFix( FT_Long a, 3767 FT_Long b ); 3768 3769 /* */ 3770 #endif 3771 3772 #ifdef FT_MULFIX_INLINED 3773 #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b ) 3774 #else 3775 FT_EXPORT( FT_Long ) 3776 FT_MulFix( FT_Long a, 3777 FT_Long b ); 3778 #endif 3779 3780 3781 /*************************************************************************/ 3782 /* */ 3783 /* <Function> */ 3784 /* FT_DivFix */ 3785 /* */ 3786 /* <Description> */ 3787 /* A very simple function used to perform the computation */ 3788 /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ 3789 /* used to divide a given value by a 16.16 fixed-point factor. */ 3790 /* */ 3791 /* <Input> */ 3792 /* a :: The first multiplier. */ 3793 /* b :: The second multiplier. Use a 16.16 factor here whenever */ 3794 /* possible (see note below). */ 3795 /* */ 3796 /* <Return> */ 3797 /* The result of `(a*0x10000)/b'. */ 3798 /* */ 3799 /* <Note> */ 3800 /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */ 3801 /* 32~bits, then the division is computed directly. Otherwise, we */ 3802 /* use a specialized version of @FT_MulDiv. */ 3803 /* */ 3804 FT_EXPORT( FT_Long ) 3805 FT_DivFix( FT_Long a, 3806 FT_Long b ); 3807 3808 3809 /*************************************************************************/ 3810 /* */ 3811 /* <Function> */ 3812 /* FT_RoundFix */ 3813 /* */ 3814 /* <Description> */ 3815 /* A very simple function used to round a 16.16 fixed number. */ 3816 /* */ 3817 /* <Input> */ 3818 /* a :: The number to be rounded. */ 3819 /* */ 3820 /* <Return> */ 3821 /* The result of `(a + 0x8000) & -0x10000'. */ 3822 /* */ 3823 FT_EXPORT( FT_Fixed ) 3824 FT_RoundFix( FT_Fixed a ); 3825 3826 3827 /*************************************************************************/ 3828 /* */ 3829 /* <Function> */ 3830 /* FT_CeilFix */ 3831 /* */ 3832 /* <Description> */ 3833 /* A very simple function used to compute the ceiling function of a */ 3834 /* 16.16 fixed number. */ 3835 /* */ 3836 /* <Input> */ 3837 /* a :: The number for which the ceiling function is to be computed. */ 3838 /* */ 3839 /* <Return> */ 3840 /* The result of `(a + 0x10000 - 1) & -0x10000'. */ 3841 /* */ 3842 FT_EXPORT( FT_Fixed ) 3843 FT_CeilFix( FT_Fixed a ); 3844 3845 3846 /*************************************************************************/ 3847 /* */ 3848 /* <Function> */ 3849 /* FT_FloorFix */ 3850 /* */ 3851 /* <Description> */ 3852 /* A very simple function used to compute the floor function of a */ 3853 /* 16.16 fixed number. */ 3854 /* */ 3855 /* <Input> */ 3856 /* a :: The number for which the floor function is to be computed. */ 3857 /* */ 3858 /* <Return> */ 3859 /* The result of `a & -0x10000'. */ 3860 /* */ 3861 FT_EXPORT( FT_Fixed ) 3862 FT_FloorFix( FT_Fixed a ); 3863 3864 3865 /*************************************************************************/ 3866 /* */ 3867 /* <Function> */ 3868 /* FT_Vector_Transform */ 3869 /* */ 3870 /* <Description> */ 3871 /* Transform a single vector through a 2x2 matrix. */ 3872 /* */ 3873 /* <InOut> */ 3874 /* vector :: The target vector to transform. */ 3875 /* */ 3876 /* <Input> */ 3877 /* matrix :: A pointer to the source 2x2 matrix. */ 3878 /* */ 3879 /* <Note> */ 3880 /* The result is undefined if either `vector' or `matrix' is invalid. */ 3881 /* */ 3882 FT_EXPORT( void ) 3883 FT_Vector_Transform( FT_Vector* vec, 3884 const FT_Matrix* matrix ); 3885 3886 3887 /*************************************************************************/ 3888 /* */ 3889 /* <Section> */ 3890 /* version */ 3891 /* */ 3892 /* <Title> */ 3893 /* FreeType Version */ 3894 /* */ 3895 /* <Abstract> */ 3896 /* Functions and macros related to FreeType versions. */ 3897 /* */ 3898 /* <Description> */ 3899 /* Note that those functions and macros are of limited use because */ 3900 /* even a new release of FreeType with only documentation changes */ 3901 /* increases the version number. */ 3902 /* */ 3903 /*************************************************************************/ 3904 3905 3906 /************************************************************************* 3907 * 3908 * @enum: 3909 * FREETYPE_XXX 3910 * 3911 * @description: 3912 * These three macros identify the FreeType source code version. 3913 * Use @FT_Library_Version to access them at runtime. 3914 * 3915 * @values: 3916 * FREETYPE_MAJOR :: The major version number. 3917 * FREETYPE_MINOR :: The minor version number. 3918 * FREETYPE_PATCH :: The patch level. 3919 * 3920 * @note: 3921 * The version number of FreeType if built as a dynamic link library 3922 * with the `libtool' package is _not_ controlled by these three 3923 * macros. 3924 * 3925 */ 3926 #define FREETYPE_MAJOR 2 3927 #define FREETYPE_MINOR 5 3928 #define FREETYPE_PATCH 2 3929 3930 3931 /*************************************************************************/ 3932 /* */ 3933 /* <Function> */ 3934 /* FT_Library_Version */ 3935 /* */ 3936 /* <Description> */ 3937 /* Return the version of the FreeType library being used. This is */ 3938 /* useful when dynamically linking to the library, since one cannot */ 3939 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ 3940 /* @FREETYPE_PATCH. */ 3941 /* */ 3942 /* <Input> */ 3943 /* library :: A source library handle. */ 3944 /* */ 3945 /* <Output> */ 3946 /* amajor :: The major version number. */ 3947 /* */ 3948 /* aminor :: The minor version number. */ 3949 /* */ 3950 /* apatch :: The patch version number. */ 3951 /* */ 3952 /* <Note> */ 3953 /* The reason why this function takes a `library' argument is because */ 3954 /* certain programs implement library initialization in a custom way */ 3955 /* that doesn't use @FT_Init_FreeType. */ 3956 /* */ 3957 /* In such cases, the library version might not be available before */ 3958 /* the library object has been created. */ 3959 /* */ 3960 FT_EXPORT( void ) 3961 FT_Library_Version( FT_Library library, 3962 FT_Int *amajor, 3963 FT_Int *aminor, 3964 FT_Int *apatch ); 3965 3966 3967 /*************************************************************************/ 3968 /* */ 3969 /* <Function> */ 3970 /* FT_Face_CheckTrueTypePatents */ 3971 /* */ 3972 /* <Description> */ 3973 /* Parse all bytecode instructions of a TrueType font file to check */ 3974 /* whether any of the patented opcodes are used. This is only useful */ 3975 /* if you want to be able to use the unpatented hinter with */ 3976 /* fonts that do *not* use these opcodes. */ 3977 /* */ 3978 /* Note that this function parses *all* glyph instructions in the */ 3979 /* font file, which may be slow. */ 3980 /* */ 3981 /* <Input> */ 3982 /* face :: A face handle. */ 3983 /* */ 3984 /* <Return> */ 3985 /* 1~if this is a TrueType font that uses one of the patented */ 3986 /* opcodes, 0~otherwise. */ 3987 /* */ 3988 /* <Note> */ 3989 /* Since May 2010, TrueType hinting is no longer patented. */ 3990 /* */ 3991 /* <Since> */ 3992 /* 2.3.5 */ 3993 /* */ 3994 FT_EXPORT( FT_Bool ) 3995 FT_Face_CheckTrueTypePatents( FT_Face face ); 3996 3997 3998 /*************************************************************************/ 3999 /* */ 4000 /* <Function> */ 4001 /* FT_Face_SetUnpatentedHinting */ 4002 /* */ 4003 /* <Description> */ 4004 /* Enable or disable the unpatented hinter for a given face. */ 4005 /* Only enable it if you have determined that the face doesn't */ 4006 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */ 4007 /* */ 4008 /* <Input> */ 4009 /* face :: A face handle. */ 4010 /* */ 4011 /* value :: New boolean setting. */ 4012 /* */ 4013 /* <Return> */ 4014 /* The old setting value. This will always be false if this is not */ 4015 /* an SFNT font, or if the unpatented hinter is not compiled in this */ 4016 /* instance of the library. */ 4017 /* */ 4018 /* <Note> */ 4019 /* Since May 2010, TrueType hinting is no longer patented. */ 4020 /* */ 4021 /* <Since> */ 4022 /* 2.3.5 */ 4023 /* */ 4024 FT_EXPORT( FT_Bool ) 4025 FT_Face_SetUnpatentedHinting( FT_Face face, 4026 FT_Bool value ); 4027 4028 /* */ 4029 4030 4031 FT_END_HEADER 4032 4033 #endif /* __FREETYPE_H__ */ 4034 4035 4036 /* END */ 4037