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