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