00001 /***************************************************************************/ 00002 /* */ 00003 /* freetype.h */ 00004 /* */ 00005 /* FreeType high-level API and common types (specification only). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ 00008 /* 2010 by */ 00009 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00010 /* */ 00011 /* This file is part of the FreeType project, and may only be used, */ 00012 /* modified, and distributed under the terms of the FreeType project */ 00013 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00014 /* this file you indicate that you have read the license and */ 00015 /* understand and accept it fully. */ 00016 /* */ 00017 /***************************************************************************/ 00018 00019 00020 #ifndef FT_FREETYPE_H 00021 #error "`ft2build.h' hasn't been included yet!" 00022 #error "Please always use macros to include FreeType header files." 00023 #error "Example:" 00024 #error " #include <ft2build.h>" 00025 #error " #include FT_FREETYPE_H" 00026 #endif 00027 00028 00029 #ifndef __FREETYPE_H__ 00030 #define __FREETYPE_H__ 00031 00032 00033 #include <ft2build.h> 00034 #include FT_CONFIG_CONFIG_H 00035 #include FT_ERRORS_H 00036 #include FT_TYPES_H 00037 00038 00039 FT_BEGIN_HEADER 00040 00041 00042 00043 /*************************************************************************/ 00044 /* */ 00045 /* <Section> */ 00046 /* user_allocation */ 00047 /* */ 00048 /* <Title> */ 00049 /* User allocation */ 00050 /* */ 00051 /* <Abstract> */ 00052 /* How client applications should allocate FreeType data structures. */ 00053 /* */ 00054 /* <Description> */ 00055 /* FreeType assumes that structures allocated by the user and passed */ 00056 /* as arguments are zeroed out except for the actual data. In other */ 00057 /* words, it is recommended to use `calloc' (or variants of it) */ 00058 /* instead of `malloc' for allocation. */ 00059 /* */ 00060 /*************************************************************************/ 00061 00062 00063 00064 /*************************************************************************/ 00065 /*************************************************************************/ 00066 /* */ 00067 /* B A S I C T Y P E S */ 00068 /* */ 00069 /*************************************************************************/ 00070 /*************************************************************************/ 00071 00072 00073 /*************************************************************************/ 00074 /* */ 00075 /* <Section> */ 00076 /* base_interface */ 00077 /* */ 00078 /* <Title> */ 00079 /* Base Interface */ 00080 /* */ 00081 /* <Abstract> */ 00082 /* The FreeType~2 base font interface. */ 00083 /* */ 00084 /* <Description> */ 00085 /* This section describes the public high-level API of FreeType~2. */ 00086 /* */ 00087 /* <Order> */ 00088 /* FT_Library */ 00089 /* FT_Face */ 00090 /* FT_Size */ 00091 /* FT_GlyphSlot */ 00092 /* FT_CharMap */ 00093 /* FT_Encoding */ 00094 /* */ 00095 /* FT_FaceRec */ 00096 /* */ 00097 /* FT_FACE_FLAG_SCALABLE */ 00098 /* FT_FACE_FLAG_FIXED_SIZES */ 00099 /* FT_FACE_FLAG_FIXED_WIDTH */ 00100 /* FT_FACE_FLAG_HORIZONTAL */ 00101 /* FT_FACE_FLAG_VERTICAL */ 00102 /* FT_FACE_FLAG_SFNT */ 00103 /* FT_FACE_FLAG_KERNING */ 00104 /* FT_FACE_FLAG_MULTIPLE_MASTERS */ 00105 /* FT_FACE_FLAG_GLYPH_NAMES */ 00106 /* FT_FACE_FLAG_EXTERNAL_STREAM */ 00107 /* FT_FACE_FLAG_FAST_GLYPHS */ 00108 /* FT_FACE_FLAG_HINTER */ 00109 /* */ 00110 /* FT_STYLE_FLAG_BOLD */ 00111 /* FT_STYLE_FLAG_ITALIC */ 00112 /* */ 00113 /* FT_SizeRec */ 00114 /* FT_Size_Metrics */ 00115 /* */ 00116 /* FT_GlyphSlotRec */ 00117 /* FT_Glyph_Metrics */ 00118 /* FT_SubGlyph */ 00119 /* */ 00120 /* FT_Bitmap_Size */ 00121 /* */ 00122 /* FT_Init_FreeType */ 00123 /* FT_Done_FreeType */ 00124 /* */ 00125 /* FT_New_Face */ 00126 /* FT_Done_Face */ 00127 /* FT_New_Memory_Face */ 00128 /* FT_Open_Face */ 00129 /* FT_Open_Args */ 00130 /* FT_Parameter */ 00131 /* FT_Attach_File */ 00132 /* FT_Attach_Stream */ 00133 /* */ 00134 /* FT_Set_Char_Size */ 00135 /* FT_Set_Pixel_Sizes */ 00136 /* FT_Request_Size */ 00137 /* FT_Select_Size */ 00138 /* FT_Size_Request_Type */ 00139 /* FT_Size_Request */ 00140 /* FT_Set_Transform */ 00141 /* FT_Load_Glyph */ 00142 /* FT_Get_Char_Index */ 00143 /* FT_Get_Name_Index */ 00144 /* FT_Load_Char */ 00145 /* */ 00146 /* FT_OPEN_MEMORY */ 00147 /* FT_OPEN_STREAM */ 00148 /* FT_OPEN_PATHNAME */ 00149 /* FT_OPEN_DRIVER */ 00150 /* FT_OPEN_PARAMS */ 00151 /* */ 00152 /* FT_LOAD_DEFAULT */ 00153 /* FT_LOAD_RENDER */ 00154 /* FT_LOAD_MONOCHROME */ 00155 /* FT_LOAD_LINEAR_DESIGN */ 00156 /* FT_LOAD_NO_SCALE */ 00157 /* FT_LOAD_NO_HINTING */ 00158 /* FT_LOAD_NO_BITMAP */ 00159 /* FT_LOAD_CROP_BITMAP */ 00160 /* */ 00161 /* FT_LOAD_VERTICAL_LAYOUT */ 00162 /* FT_LOAD_IGNORE_TRANSFORM */ 00163 /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ 00164 /* FT_LOAD_FORCE_AUTOHINT */ 00165 /* FT_LOAD_NO_RECURSE */ 00166 /* FT_LOAD_PEDANTIC */ 00167 /* */ 00168 /* FT_LOAD_TARGET_NORMAL */ 00169 /* FT_LOAD_TARGET_LIGHT */ 00170 /* FT_LOAD_TARGET_MONO */ 00171 /* FT_LOAD_TARGET_LCD */ 00172 /* FT_LOAD_TARGET_LCD_V */ 00173 /* */ 00174 /* FT_Render_Glyph */ 00175 /* FT_Render_Mode */ 00176 /* FT_Get_Kerning */ 00177 /* FT_Kerning_Mode */ 00178 /* FT_Get_Track_Kerning */ 00179 /* FT_Get_Glyph_Name */ 00180 /* FT_Get_Postscript_Name */ 00181 /* */ 00182 /* FT_CharMapRec */ 00183 /* FT_Select_Charmap */ 00184 /* FT_Set_Charmap */ 00185 /* FT_Get_Charmap_Index */ 00186 /* */ 00187 /* FT_FSTYPE_INSTALLABLE_EMBEDDING */ 00188 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */ 00189 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */ 00190 /* FT_FSTYPE_EDITABLE_EMBEDDING */ 00191 /* FT_FSTYPE_NO_SUBSETTING */ 00192 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */ 00193 /* */ 00194 /* FT_Get_FSType_Flags */ 00195 /* */ 00196 /*************************************************************************/ 00197 00198 00199 /*************************************************************************/ 00200 /* */ 00201 /* <Struct> */ 00202 /* FT_Glyph_Metrics */ 00203 /* */ 00204 /* <Description> */ 00205 /* A structure used to model the metrics of a single glyph. The */ 00206 /* values are expressed in 26.6 fractional pixel format; if the flag */ 00207 /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ 00208 /* are expressed in font units instead. */ 00209 /* */ 00210 /* <Fields> */ 00211 /* width :: */ 00212 /* The glyph's width. */ 00213 /* */ 00214 /* height :: */ 00215 /* The glyph's height. */ 00216 /* */ 00217 /* horiBearingX :: */ 00218 /* Left side bearing for horizontal layout. */ 00219 /* */ 00220 /* horiBearingY :: */ 00221 /* Top side bearing for horizontal layout. */ 00222 /* */ 00223 /* horiAdvance :: */ 00224 /* Advance width for horizontal layout. */ 00225 /* */ 00226 /* vertBearingX :: */ 00227 /* Left side bearing for vertical layout. */ 00228 /* */ 00229 /* vertBearingY :: */ 00230 /* Top side bearing for vertical layout. */ 00231 /* */ 00232 /* vertAdvance :: */ 00233 /* Advance height for vertical layout. */ 00234 /* */ 00235 /* <Note> */ 00236 /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ 00237 /* dimensions of the hinted glyph (in case hinting is applicable). */ 00238 /* */ 00239 typedef struct FT_Glyph_Metrics_ 00240 { 00241 FT_Pos width; 00242 FT_Pos height; 00243 00244 FT_Pos horiBearingX; 00245 FT_Pos horiBearingY; 00246 FT_Pos horiAdvance; 00247 00248 FT_Pos vertBearingX; 00249 FT_Pos vertBearingY; 00250 FT_Pos vertAdvance; 00251 00252 } FT_Glyph_Metrics; 00253 00254 00255 /*************************************************************************/ 00256 /* */ 00257 /* <Struct> */ 00258 /* FT_Bitmap_Size */ 00259 /* */ 00260 /* <Description> */ 00261 /* This structure models the metrics of a bitmap strike (i.e., a set */ 00262 /* of glyphs for a given point size and resolution) in a bitmap font. */ 00263 /* It is used for the `available_sizes' field of @FT_Face. */ 00264 /* */ 00265 /* <Fields> */ 00266 /* height :: The vertical distance, in pixels, between two */ 00267 /* consecutive baselines. It is always positive. */ 00268 /* */ 00269 /* width :: The average width, in pixels, of all glyphs in the */ 00270 /* strike. */ 00271 /* */ 00272 /* size :: The nominal size of the strike in 26.6 fractional */ 00273 /* points. This field is not very useful. */ 00274 /* */ 00275 /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ 00276 /* pixels. */ 00277 /* */ 00278 /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ 00279 /* pixels. */ 00280 /* */ 00281 /* <Note> */ 00282 /* Windows FNT: */ 00283 /* The nominal size given in a FNT font is not reliable. Thus when */ 00284 /* the driver finds it incorrect, it sets `size' to some calculated */ 00285 /* values and sets `x_ppem' and `y_ppem' to the pixel width and */ 00286 /* height given in the font, respectively. */ 00287 /* */ 00288 /* TrueType embedded bitmaps: */ 00289 /* `size', `width', and `height' values are not contained in the */ 00290 /* bitmap strike itself. They are computed from the global font */ 00291 /* parameters. */ 00292 /* */ 00293 typedef struct FT_Bitmap_Size_ 00294 { 00295 FT_Short height; 00296 FT_Short width; 00297 00298 FT_Pos size; 00299 00300 FT_Pos x_ppem; 00301 FT_Pos y_ppem; 00302 00303 } FT_Bitmap_Size; 00304 00305 00306 /*************************************************************************/ 00307 /*************************************************************************/ 00308 /* */ 00309 /* O B J E C T C L A S S E S */ 00310 /* */ 00311 /*************************************************************************/ 00312 /*************************************************************************/ 00313 00314 /*************************************************************************/ 00315 /* */ 00316 /* <Type> */ 00317 /* FT_Library */ 00318 /* */ 00319 /* <Description> */ 00320 /* A handle to a FreeType library instance. Each `library' is */ 00321 /* completely independent from the others; it is the `root' of a set */ 00322 /* of objects like fonts, faces, sizes, etc. */ 00323 /* */ 00324 /* It also embeds a memory manager (see @FT_Memory), as well as a */ 00325 /* scan-line converter object (see @FT_Raster). */ 00326 /* */ 00327 /* For multi-threading applications each thread should have its own */ 00328 /* FT_Library object. */ 00329 /* */ 00330 /* <Note> */ 00331 /* Library objects are normally created by @FT_Init_FreeType, and */ 00332 /* destroyed with @FT_Done_FreeType. */ 00333 /* */ 00334 typedef struct FT_LibraryRec_ *FT_Library; 00335 00336 00337 /*************************************************************************/ 00338 /* */ 00339 /* <Type> */ 00340 /* FT_Module */ 00341 /* */ 00342 /* <Description> */ 00343 /* A handle to a given FreeType module object. Each module can be a */ 00344 /* font driver, a renderer, or anything else that provides services */ 00345 /* to the formers. */ 00346 /* */ 00347 typedef struct FT_ModuleRec_* FT_Module; 00348 00349 00350 /*************************************************************************/ 00351 /* */ 00352 /* <Type> */ 00353 /* FT_Driver */ 00354 /* */ 00355 /* <Description> */ 00356 /* A handle to a given FreeType font driver object. Each font driver */ 00357 /* is a special module capable of creating faces from font files. */ 00358 /* */ 00359 typedef struct FT_DriverRec_* FT_Driver; 00360 00361 00362 /*************************************************************************/ 00363 /* */ 00364 /* <Type> */ 00365 /* FT_Renderer */ 00366 /* */ 00367 /* <Description> */ 00368 /* A handle to a given FreeType renderer. A renderer is a special */ 00369 /* module in charge of converting a glyph image to a bitmap, when */ 00370 /* necessary. Each renderer supports a given glyph image format, and */ 00371 /* one or more target surface depths. */ 00372 /* */ 00373 typedef struct FT_RendererRec_* FT_Renderer; 00374 00375 00376 /*************************************************************************/ 00377 /* */ 00378 /* <Type> */ 00379 /* FT_Face */ 00380 /* */ 00381 /* <Description> */ 00382 /* A handle to a given typographic face object. A face object models */ 00383 /* a given typeface, in a given style. */ 00384 /* */ 00385 /* <Note> */ 00386 /* Each face object also owns a single @FT_GlyphSlot object, as well */ 00387 /* as one or more @FT_Size objects. */ 00388 /* */ 00389 /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ 00390 /* a given filepathname or a custom input stream. */ 00391 /* */ 00392 /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ 00393 /* */ 00394 /* <Also> */ 00395 /* See @FT_FaceRec for the publicly accessible fields of a given face */ 00396 /* object. */ 00397 /* */ 00398 typedef struct FT_FaceRec_* FT_Face; 00399 00400 00401 /*************************************************************************/ 00402 /* */ 00403 /* <Type> */ 00404 /* FT_Size */ 00405 /* */ 00406 /* <Description> */ 00407 /* A handle to an object used to model a face scaled to a given */ 00408 /* character size. */ 00409 /* */ 00410 /* <Note> */ 00411 /* Each @FT_Face has an _active_ @FT_Size object that is used by */ 00412 /* functions like @FT_Load_Glyph to determine the scaling */ 00413 /* transformation which is used to load and hint glyphs and metrics. */ 00414 /* */ 00415 /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ 00416 /* @FT_Request_Size or even @FT_Select_Size to change the content */ 00417 /* (i.e., the scaling values) of the active @FT_Size. */ 00418 /* */ 00419 /* You can use @FT_New_Size to create additional size objects for a */ 00420 /* given @FT_Face, but they won't be used by other functions until */ 00421 /* you activate it through @FT_Activate_Size. Only one size can be */ 00422 /* activated at any given time per face. */ 00423 /* */ 00424 /* <Also> */ 00425 /* See @FT_SizeRec for the publicly accessible fields of a given size */ 00426 /* object. */ 00427 /* */ 00428 typedef struct FT_SizeRec_* FT_Size; 00429 00430 00431 /*************************************************************************/ 00432 /* */ 00433 /* <Type> */ 00434 /* FT_GlyphSlot */ 00435 /* */ 00436 /* <Description> */ 00437 /* A handle to a given `glyph slot'. A slot is a container where it */ 00438 /* is possible to load any of the glyphs contained in its parent */ 00439 /* face. */ 00440 /* */ 00441 /* In other words, each time you call @FT_Load_Glyph or */ 00442 /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ 00443 /* i.e., the glyph's metrics, its image (bitmap or outline), and */ 00444 /* other control information. */ 00445 /* */ 00446 /* <Also> */ 00447 /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ 00448 /* */ 00449 typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; 00450 00451 00452 /*************************************************************************/ 00453 /* */ 00454 /* <Type> */ 00455 /* FT_CharMap */ 00456 /* */ 00457 /* <Description> */ 00458 /* A handle to a given character map. A charmap is used to translate */ 00459 /* character codes in a given encoding into glyph indexes for its */ 00460 /* parent's face. Some font formats may provide several charmaps per */ 00461 /* font. */ 00462 /* */ 00463 /* Each face object owns zero or more charmaps, but only one of them */ 00464 /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */ 00465 /* */ 00466 /* The list of available charmaps in a face is available through the */ 00467 /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ 00468 /* */ 00469 /* The currently active charmap is available as `face->charmap'. */ 00470 /* You should call @FT_Set_Charmap to change it. */ 00471 /* */ 00472 /* <Note> */ 00473 /* When a new face is created (either through @FT_New_Face or */ 00474 /* @FT_Open_Face), the library looks for a Unicode charmap within */ 00475 /* the list and automatically activates it. */ 00476 /* */ 00477 /* <Also> */ 00478 /* See @FT_CharMapRec for the publicly accessible fields of a given */ 00479 /* character map. */ 00480 /* */ 00481 typedef struct FT_CharMapRec_* FT_CharMap; 00482 00483 00484 /*************************************************************************/ 00485 /* */ 00486 /* <Macro> */ 00487 /* FT_ENC_TAG */ 00488 /* */ 00489 /* <Description> */ 00490 /* This macro converts four-letter tags into an unsigned long. It is */ 00491 /* used to define `encoding' identifiers (see @FT_Encoding). */ 00492 /* */ 00493 /* <Note> */ 00494 /* Since many 16-bit compilers don't like 32-bit enumerations, you */ 00495 /* should redefine this macro in case of problems to something like */ 00496 /* this: */ 00497 /* */ 00498 /* { */ 00499 /* #define FT_ENC_TAG( value, a, b, c, d ) value */ 00500 /* } */ 00501 /* */ 00502 /* to get a simple enumeration without assigning special numbers. */ 00503 /* */ 00504 00505 #ifndef FT_ENC_TAG 00506 #define FT_ENC_TAG( value, a, b, c, d ) \ 00507 value = ( ( (FT_UInt32)(a) << 24 ) | \ 00508 ( (FT_UInt32)(b) << 16 ) | \ 00509 ( (FT_UInt32)(c) << 8 ) | \ 00510 (FT_UInt32)(d) ) 00511 00512 #endif /* FT_ENC_TAG */ 00513 00514 00515 /*************************************************************************/ 00516 /* */ 00517 /* <Enum> */ 00518 /* FT_Encoding */ 00519 /* */ 00520 /* <Description> */ 00521 /* An enumeration used to specify character sets supported by */ 00522 /* charmaps. Used in the @FT_Select_Charmap API function. */ 00523 /* */ 00524 /* <Note> */ 00525 /* Despite the name, this enumeration lists specific character */ 00526 /* repertories (i.e., charsets), and not text encoding methods (e.g., */ 00527 /* UTF-8, UTF-16, etc.). */ 00528 /* */ 00529 /* Other encodings might be defined in the future. */ 00530 /* */ 00531 /* <Values> */ 00532 /* FT_ENCODING_NONE :: */ 00533 /* The encoding value~0 is reserved. */ 00534 /* */ 00535 /* FT_ENCODING_UNICODE :: */ 00536 /* Corresponds to the Unicode character set. This value covers */ 00537 /* all versions of the Unicode repertoire, including ASCII and */ 00538 /* Latin-1. Most fonts include a Unicode charmap, but not all */ 00539 /* of them. */ 00540 /* */ 00541 /* For example, if you want to access Unicode value U+1F028 (and */ 00542 /* the font contains it), use value 0x1F028 as the input value for */ 00543 /* @FT_Get_Char_Index. */ 00544 /* */ 00545 /* FT_ENCODING_MS_SYMBOL :: */ 00546 /* Corresponds to the Microsoft Symbol encoding, used to encode */ 00547 /* mathematical symbols in the 32..255 character code range. For */ 00548 /* more information, see `http://www.ceviz.net/symbol.htm'. */ 00549 /* */ 00550 /* FT_ENCODING_SJIS :: */ 00551 /* Corresponds to Japanese SJIS encoding. More info at */ 00552 /* at `http://langsupport.japanreference.com/encoding.shtml'. */ 00553 /* See note on multi-byte encodings below. */ 00554 /* */ 00555 /* FT_ENCODING_GB2312 :: */ 00556 /* Corresponds to an encoding system for Simplified Chinese as used */ 00557 /* used in mainland China. */ 00558 /* */ 00559 /* FT_ENCODING_BIG5 :: */ 00560 /* Corresponds to an encoding system for Traditional Chinese as */ 00561 /* used in Taiwan and Hong Kong. */ 00562 /* */ 00563 /* FT_ENCODING_WANSUNG :: */ 00564 /* Corresponds to the Korean encoding system known as Wansung. */ 00565 /* For more information see */ 00566 /* `http://www.microsoft.com/typography/unicode/949.txt'. */ 00567 /* */ 00568 /* FT_ENCODING_JOHAB :: */ 00569 /* The Korean standard character set (KS~C 5601-1992), which */ 00570 /* corresponds to MS Windows code page 1361. This character set */ 00571 /* includes all possible Hangeul character combinations. */ 00572 /* */ 00573 /* FT_ENCODING_ADOBE_LATIN_1 :: */ 00574 /* Corresponds to a Latin-1 encoding as defined in a Type~1 */ 00575 /* PostScript font. It is limited to 256 character codes. */ 00576 /* */ 00577 /* FT_ENCODING_ADOBE_STANDARD :: */ 00578 /* Corresponds to the Adobe Standard encoding, as found in Type~1, */ 00579 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ 00580 /* codes. */ 00581 /* */ 00582 /* FT_ENCODING_ADOBE_EXPERT :: */ 00583 /* Corresponds to the Adobe Expert encoding, as found in Type~1, */ 00584 /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ 00585 /* codes. */ 00586 /* */ 00587 /* FT_ENCODING_ADOBE_CUSTOM :: */ 00588 /* Corresponds to a custom encoding, as found in Type~1, CFF, and */ 00589 /* OpenType/CFF fonts. It is limited to 256 character codes. */ 00590 /* */ 00591 /* FT_ENCODING_APPLE_ROMAN :: */ 00592 /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */ 00593 /* and OpenType fonts contain a charmap for this encoding, since */ 00594 /* older versions of Mac OS are able to use it. */ 00595 /* */ 00596 /* FT_ENCODING_OLD_LATIN_2 :: */ 00597 /* This value is deprecated and was never used nor reported by */ 00598 /* FreeType. Don't use or test for it. */ 00599 /* */ 00600 /* FT_ENCODING_MS_SJIS :: */ 00601 /* Same as FT_ENCODING_SJIS. Deprecated. */ 00602 /* */ 00603 /* FT_ENCODING_MS_GB2312 :: */ 00604 /* Same as FT_ENCODING_GB2312. Deprecated. */ 00605 /* */ 00606 /* FT_ENCODING_MS_BIG5 :: */ 00607 /* Same as FT_ENCODING_BIG5. Deprecated. */ 00608 /* */ 00609 /* FT_ENCODING_MS_WANSUNG :: */ 00610 /* Same as FT_ENCODING_WANSUNG. Deprecated. */ 00611 /* */ 00612 /* FT_ENCODING_MS_JOHAB :: */ 00613 /* Same as FT_ENCODING_JOHAB. Deprecated. */ 00614 /* */ 00615 /* <Note> */ 00616 /* By default, FreeType automatically synthesizes a Unicode charmap */ 00617 /* for PostScript fonts, using their glyph names dictionaries. */ 00618 /* However, it also reports the encodings defined explicitly in the */ 00619 /* font file, for the cases when they are needed, with the Adobe */ 00620 /* values as well. */ 00621 /* */ 00622 /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ 00623 /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ 00624 /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ 00625 /* which encoding is really present. If, for example, the */ 00626 /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ 00627 /* the font is encoded in KOI8-R. */ 00628 /* */ 00629 /* FT_ENCODING_NONE is always set (with a single exception) by the */ 00630 /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ 00631 /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ 00632 /* which encoding is really present. For example, */ 00633 /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ 00634 /* Russian). */ 00635 /* */ 00636 /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ 00637 /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */ 00638 /* FT_ENCODING_APPLE_ROMAN). */ 00639 /* */ 00640 /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ 00641 /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */ 00642 /* be needed to be able to distinguish Apple encoding variants. See */ 00643 /* */ 00644 /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */ 00645 /* */ 00646 /* to get an idea how to do that. Basically, if the language ID */ 00647 /* is~0, don't use it, otherwise subtract 1 from the language ID. */ 00648 /* Then examine `encoding_id'. If, for example, `encoding_id' is */ 00649 /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */ 00650 /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ 00651 /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */ 00652 /* variant the Arabic encoding. */ 00653 /* */ 00654 typedef enum FT_Encoding_ 00655 { 00656 FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), 00657 00658 FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), 00659 FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), 00660 00661 FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), 00662 FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), 00663 FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), 00664 FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), 00665 FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), 00666 00667 /* for backwards compatibility */ 00668 FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, 00669 FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, 00670 FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, 00671 FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, 00672 FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, 00673 00674 FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), 00675 FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), 00676 FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), 00677 FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), 00678 00679 FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), 00680 00681 FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) 00682 00683 } FT_Encoding; 00684 00685 00686 /*************************************************************************/ 00687 /* */ 00688 /* <Enum> */ 00689 /* ft_encoding_xxx */ 00690 /* */ 00691 /* <Description> */ 00692 /* These constants are deprecated; use the corresponding @FT_Encoding */ 00693 /* values instead. */ 00694 /* */ 00695 #define ft_encoding_none FT_ENCODING_NONE 00696 #define ft_encoding_unicode FT_ENCODING_UNICODE 00697 #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL 00698 #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 00699 #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 00700 #define ft_encoding_sjis FT_ENCODING_SJIS 00701 #define ft_encoding_gb2312 FT_ENCODING_GB2312 00702 #define ft_encoding_big5 FT_ENCODING_BIG5 00703 #define ft_encoding_wansung FT_ENCODING_WANSUNG 00704 #define ft_encoding_johab FT_ENCODING_JOHAB 00705 00706 #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD 00707 #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT 00708 #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM 00709 #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN 00710 00711 00712 /*************************************************************************/ 00713 /* */ 00714 /* <Struct> */ 00715 /* FT_CharMapRec */ 00716 /* */ 00717 /* <Description> */ 00718 /* The base charmap structure. */ 00719 /* */ 00720 /* <Fields> */ 00721 /* face :: A handle to the parent face object. */ 00722 /* */ 00723 /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ 00724 /* this with @FT_Select_Charmap. */ 00725 /* */ 00726 /* platform_id :: An ID number describing the platform for the */ 00727 /* following encoding ID. This comes directly from */ 00728 /* the TrueType specification and should be emulated */ 00729 /* for other formats. */ 00730 /* */ 00731 /* encoding_id :: A platform specific encoding number. This also */ 00732 /* comes from the TrueType specification and should be */ 00733 /* emulated similarly. */ 00734 /* */ 00735 typedef struct FT_CharMapRec_ 00736 { 00737 FT_Face face; 00738 FT_Encoding encoding; 00739 FT_UShort platform_id; 00740 FT_UShort encoding_id; 00741 00742 } FT_CharMapRec; 00743 00744 00745 /*************************************************************************/ 00746 /*************************************************************************/ 00747 /* */ 00748 /* B A S E O B J E C T C L A S S E S */ 00749 /* */ 00750 /*************************************************************************/ 00751 /*************************************************************************/ 00752 00753 00754 /*************************************************************************/ 00755 /* */ 00756 /* <Type> */ 00757 /* FT_Face_Internal */ 00758 /* */ 00759 /* <Description> */ 00760 /* An opaque handle to an `FT_Face_InternalRec' structure, used to */ 00761 /* model private data of a given @FT_Face object. */ 00762 /* */ 00763 /* This structure might change between releases of FreeType~2 and is */ 00764 /* not generally available to client applications. */ 00765 /* */ 00766 typedef struct FT_Face_InternalRec_* FT_Face_Internal; 00767 00768 00769 /*************************************************************************/ 00770 /* */ 00771 /* <Struct> */ 00772 /* FT_FaceRec */ 00773 /* */ 00774 /* <Description> */ 00775 /* FreeType root face class structure. A face object models a */ 00776 /* typeface in a font file. */ 00777 /* */ 00778 /* <Fields> */ 00779 /* num_faces :: The number of faces in the font file. Some */ 00780 /* font formats can have multiple faces in */ 00781 /* a font file. */ 00782 /* */ 00783 /* face_index :: The index of the face in the font file. It */ 00784 /* is set to~0 if there is only one face in */ 00785 /* the font file. */ 00786 /* */ 00787 /* face_flags :: A set of bit flags that give important */ 00788 /* information about the face; see */ 00789 /* @FT_FACE_FLAG_XXX for the details. */ 00790 /* */ 00791 /* style_flags :: A set of bit flags indicating the style of */ 00792 /* the face; see @FT_STYLE_FLAG_XXX for the */ 00793 /* details. */ 00794 /* */ 00795 /* num_glyphs :: The number of glyphs in the face. If the */ 00796 /* face is scalable and has sbits (see */ 00797 /* `num_fixed_sizes'), it is set to the number */ 00798 /* of outline glyphs. */ 00799 /* */ 00800 /* For CID-keyed fonts, this value gives the */ 00801 /* highest CID used in the font. */ 00802 /* */ 00803 /* family_name :: The face's family name. This is an ASCII */ 00804 /* string, usually in English, which describes */ 00805 /* the typeface's family (like `Times New */ 00806 /* Roman', `Bodoni', `Garamond', etc). This */ 00807 /* is a least common denominator used to list */ 00808 /* fonts. Some formats (TrueType & OpenType) */ 00809 /* provide localized and Unicode versions of */ 00810 /* this string. Applications should use the */ 00811 /* format specific interface to access them. */ 00812 /* Can be NULL (e.g., in fonts embedded in a */ 00813 /* PDF file). */ 00814 /* */ 00815 /* style_name :: The face's style name. This is an ASCII */ 00816 /* string, usually in English, which describes */ 00817 /* the typeface's style (like `Italic', */ 00818 /* `Bold', `Condensed', etc). Not all font */ 00819 /* formats provide a style name, so this field */ 00820 /* is optional, and can be set to NULL. As */ 00821 /* for `family_name', some formats provide */ 00822 /* localized and Unicode versions of this */ 00823 /* string. Applications should use the format */ 00824 /* specific interface to access them. */ 00825 /* */ 00826 /* num_fixed_sizes :: The number of bitmap strikes in the face. */ 00827 /* Even if the face is scalable, there might */ 00828 /* still be bitmap strikes, which are called */ 00829 /* `sbits' in that case. */ 00830 /* */ 00831 /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ 00832 /* strikes in the face. It is set to NULL if */ 00833 /* there is no bitmap strike. */ 00834 /* */ 00835 /* num_charmaps :: The number of charmaps in the face. */ 00836 /* */ 00837 /* charmaps :: An array of the charmaps of the face. */ 00838 /* */ 00839 /* generic :: A field reserved for client uses. See the */ 00840 /* @FT_Generic type description. */ 00841 /* */ 00842 /* bbox :: The font bounding box. Coordinates are */ 00843 /* expressed in font units (see */ 00844 /* `units_per_EM'). The box is large enough */ 00845 /* to contain any glyph from the font. Thus, */ 00846 /* `bbox.yMax' can be seen as the `maximal */ 00847 /* ascender', and `bbox.yMin' as the `minimal */ 00848 /* descender'. Only relevant for scalable */ 00849 /* formats. */ 00850 /* */ 00851 /* Note that the bounding box might be off by */ 00852 /* (at least) one pixel for hinted fonts. See */ 00853 /* @FT_Size_Metrics for further discussion. */ 00854 /* */ 00855 /* units_per_EM :: The number of font units per EM square for */ 00856 /* this face. This is typically 2048 for */ 00857 /* TrueType fonts, and 1000 for Type~1 fonts. */ 00858 /* Only relevant for scalable formats. */ 00859 /* */ 00860 /* ascender :: The typographic ascender of the face, */ 00861 /* expressed in font units. For font formats */ 00862 /* not having this information, it is set to */ 00863 /* `bbox.yMax'. Only relevant for scalable */ 00864 /* formats. */ 00865 /* */ 00866 /* descender :: The typographic descender of the face, */ 00867 /* expressed in font units. For font formats */ 00868 /* not having this information, it is set to */ 00869 /* `bbox.yMin'. Note that this field is */ 00870 /* usually negative. Only relevant for */ 00871 /* scalable formats. */ 00872 /* */ 00873 /* height :: The height is the vertical distance */ 00874 /* between two consecutive baselines, */ 00875 /* expressed in font units. It is always */ 00876 /* positive. Only relevant for scalable */ 00877 /* formats. */ 00878 /* */ 00879 /* max_advance_width :: The maximal advance width, in font units, */ 00880 /* for all glyphs in this face. This can be */ 00881 /* used to make word wrapping computations */ 00882 /* faster. Only relevant for scalable */ 00883 /* formats. */ 00884 /* */ 00885 /* max_advance_height :: The maximal advance height, in font units, */ 00886 /* for all glyphs in this face. This is only */ 00887 /* relevant for vertical layouts, and is set */ 00888 /* to `height' for fonts that do not provide */ 00889 /* vertical metrics. Only relevant for */ 00890 /* scalable formats. */ 00891 /* */ 00892 /* underline_position :: The position, in font units, of the */ 00893 /* underline line for this face. It is the */ 00894 /* center of the underlining stem. Only */ 00895 /* relevant for scalable formats. */ 00896 /* */ 00897 /* underline_thickness :: The thickness, in font units, of the */ 00898 /* underline for this face. Only relevant for */ 00899 /* scalable formats. */ 00900 /* */ 00901 /* glyph :: The face's associated glyph slot(s). */ 00902 /* */ 00903 /* size :: The current active size for this face. */ 00904 /* */ 00905 /* charmap :: The current active charmap for this face. */ 00906 /* */ 00907 /* <Note> */ 00908 /* Fields may be changed after a call to @FT_Attach_File or */ 00909 /* @FT_Attach_Stream. */ 00910 /* */ 00911 typedef struct FT_FaceRec_ 00912 { 00913 FT_Long num_faces; 00914 FT_Long face_index; 00915 00916 FT_Long face_flags; 00917 FT_Long style_flags; 00918 00919 FT_Long num_glyphs; 00920 00921 FT_String* family_name; 00922 FT_String* style_name; 00923 00924 FT_Int num_fixed_sizes; 00925 FT_Bitmap_Size* available_sizes; 00926 00927 FT_Int num_charmaps; 00928 FT_CharMap* charmaps; 00929 00930 FT_Generic generic; 00931 00932 /*# The following member variables (down to `underline_thickness') */ 00933 /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ 00934 /*# for bitmap fonts. */ 00935 FT_BBox bbox; 00936 00937 FT_UShort units_per_EM; 00938 FT_Short ascender; 00939 FT_Short descender; 00940 FT_Short height; 00941 00942 FT_Short max_advance_width; 00943 FT_Short max_advance_height; 00944 00945 FT_Short underline_position; 00946 FT_Short underline_thickness; 00947 00948 FT_GlyphSlot glyph; 00949 FT_Size size; 00950 FT_CharMap charmap; 00951 00952 /*@private begin */ 00953 00954 FT_Driver driver; 00955 FT_Memory memory; 00956 FT_Stream stream; 00957 00958 FT_ListRec sizes_list; 00959 00960 FT_Generic autohint; 00961 void* extensions; 00962 00963 FT_Face_Internal internal; 00964 00965 /*@private end */ 00966 00967 } FT_FaceRec; 00968 00969 00970 /*************************************************************************/ 00971 /* */ 00972 /* <Enum> */ 00973 /* FT_FACE_FLAG_XXX */ 00974 /* */ 00975 /* <Description> */ 00976 /* A list of bit flags used in the `face_flags' field of the */ 00977 /* @FT_FaceRec structure. They inform client applications of */ 00978 /* properties of the corresponding face. */ 00979 /* */ 00980 /* <Values> */ 00981 /* FT_FACE_FLAG_SCALABLE :: */ 00982 /* Indicates that the face contains outline glyphs. This doesn't */ 00983 /* prevent bitmap strikes, i.e., a face can have both this and */ 00984 /* and @FT_FACE_FLAG_FIXED_SIZES set. */ 00985 /* */ 00986 /* FT_FACE_FLAG_FIXED_SIZES :: */ 00987 /* Indicates that the face contains bitmap strikes. See also the */ 00988 /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ 00989 /* */ 00990 /* FT_FACE_FLAG_FIXED_WIDTH :: */ 00991 /* Indicates that the face contains fixed-width characters (like */ 00992 /* Courier, Lucido, MonoType, etc.). */ 00993 /* */ 00994 /* FT_FACE_FLAG_SFNT :: */ 00995 /* Indicates that the face uses the `sfnt' storage scheme. For */ 00996 /* now, this means TrueType and OpenType. */ 00997 /* */ 00998 /* FT_FACE_FLAG_HORIZONTAL :: */ 00999 /* Indicates that the face contains horizontal glyph metrics. This */ 01000 /* should be set for all common formats. */ 01001 /* */ 01002 /* FT_FACE_FLAG_VERTICAL :: */ 01003 /* Indicates that the face contains vertical glyph metrics. This */ 01004 /* is only available in some formats, not all of them. */ 01005 /* */ 01006 /* FT_FACE_FLAG_KERNING :: */ 01007 /* Indicates that the face contains kerning information. If set, */ 01008 /* the kerning distance can be retrieved through the function */ 01009 /* @FT_Get_Kerning. Otherwise the function always return the */ 01010 /* vector (0,0). Note that FreeType doesn't handle kerning data */ 01011 /* from the `GPOS' table (as present in some OpenType fonts). */ 01012 /* */ 01013 /* FT_FACE_FLAG_FAST_GLYPHS :: */ 01014 /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ 01015 /* */ 01016 /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ 01017 /* Indicates that the font contains multiple masters and is capable */ 01018 /* of interpolating between them. See the multiple-masters */ 01019 /* specific API for details. */ 01020 /* */ 01021 /* FT_FACE_FLAG_GLYPH_NAMES :: */ 01022 /* Indicates that the font contains glyph names that can be */ 01023 /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ 01024 /* fonts contain broken glyph name tables. Use the function */ 01025 /* @FT_Has_PS_Glyph_Names when needed. */ 01026 /* */ 01027 /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ 01028 /* Used internally by FreeType to indicate that a face's stream was */ 01029 /* provided by the client application and should not be destroyed */ 01030 /* when @FT_Done_Face is called. Don't read or test this flag. */ 01031 /* */ 01032 /* FT_FACE_FLAG_HINTER :: */ 01033 /* Set if the font driver has a hinting machine of its own. For */ 01034 /* example, with TrueType fonts, it makes sense to use data from */ 01035 /* the SFNT `gasp' table only if the native TrueType hinting engine */ 01036 /* (with the bytecode interpreter) is available and active. */ 01037 /* */ 01038 /* FT_FACE_FLAG_CID_KEYED :: */ 01039 /* Set if the font is CID-keyed. In that case, the font is not */ 01040 /* accessed by glyph indices but by CID values. For subsetted */ 01041 /* CID-keyed fonts this has the consequence that not all index */ 01042 /* values are a valid argument to FT_Load_Glyph. Only the CID */ 01043 /* values for which corresponding glyphs in the subsetted font */ 01044 /* exist make FT_Load_Glyph return successfully; in all other cases */ 01045 /* you get an `FT_Err_Invalid_Argument' error. */ 01046 /* */ 01047 /* Note that CID-keyed fonts which are in an SFNT wrapper don't */ 01048 /* have this flag set since the glyphs are accessed in the normal */ 01049 /* way (using contiguous indices); the `CID-ness' isn't visible to */ 01050 /* the application. */ 01051 /* */ 01052 /* FT_FACE_FLAG_TRICKY :: */ 01053 /* Set if the font is `tricky', this is, it always needs the */ 01054 /* font format's native hinting engine to get a reasonable result. */ 01055 /* A typical example is the Chinese font `mingli.ttf' which uses */ 01056 /* TrueType bytecode instructions to move and scale all of its */ 01057 /* subglyphs. */ 01058 /* */ 01059 /* It is not possible to autohint such fonts using */ 01060 /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ 01061 /* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */ 01062 /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ 01063 /* probably never want this except for demonstration purposes. */ 01064 /* */ 01065 /* Currently, there are six TrueType fonts in the list of tricky */ 01066 /* fonts; they are hard-coded in file `ttobjs.c'. */ 01067 /* */ 01068 #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) 01069 #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) 01070 #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) 01071 #define FT_FACE_FLAG_SFNT ( 1L << 3 ) 01072 #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) 01073 #define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) 01074 #define FT_FACE_FLAG_KERNING ( 1L << 6 ) 01075 #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) 01076 #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) 01077 #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) 01078 #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) 01079 #define FT_FACE_FLAG_HINTER ( 1L << 11 ) 01080 #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) 01081 #define FT_FACE_FLAG_TRICKY ( 1L << 13 ) 01082 01083 01084 /************************************************************************* 01085 * 01086 * @macro: 01087 * FT_HAS_HORIZONTAL( face ) 01088 * 01089 * @description: 01090 * A macro that returns true whenever a face object contains 01091 * horizontal metrics (this is true for all font formats though). 01092 * 01093 * @also: 01094 * @FT_HAS_VERTICAL can be used to check for vertical metrics. 01095 * 01096 */ 01097 #define FT_HAS_HORIZONTAL( face ) \ 01098 ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) 01099 01100 01101 /************************************************************************* 01102 * 01103 * @macro: 01104 * FT_HAS_VERTICAL( face ) 01105 * 01106 * @description: 01107 * A macro that returns true whenever a face object contains vertical 01108 * metrics. 01109 * 01110 */ 01111 #define FT_HAS_VERTICAL( face ) \ 01112 ( face->face_flags & FT_FACE_FLAG_VERTICAL ) 01113 01114 01115 /************************************************************************* 01116 * 01117 * @macro: 01118 * FT_HAS_KERNING( face ) 01119 * 01120 * @description: 01121 * A macro that returns true whenever a face object contains kerning 01122 * data that can be accessed with @FT_Get_Kerning. 01123 * 01124 */ 01125 #define FT_HAS_KERNING( face ) \ 01126 ( face->face_flags & FT_FACE_FLAG_KERNING ) 01127 01128 01129 /************************************************************************* 01130 * 01131 * @macro: 01132 * FT_IS_SCALABLE( face ) 01133 * 01134 * @description: 01135 * A macro that returns true whenever a face object contains a scalable 01136 * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, 01137 * and PFR font formats. 01138 * 01139 */ 01140 #define FT_IS_SCALABLE( face ) \ 01141 ( face->face_flags & FT_FACE_FLAG_SCALABLE ) 01142 01143 01144 /************************************************************************* 01145 * 01146 * @macro: 01147 * FT_IS_SFNT( face ) 01148 * 01149 * @description: 01150 * A macro that returns true whenever a face object contains a font 01151 * whose format is based on the SFNT storage scheme. This usually 01152 * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded 01153 * bitmap fonts. 01154 * 01155 * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and 01156 * @FT_TRUETYPE_TABLES_H are available. 01157 * 01158 */ 01159 #define FT_IS_SFNT( face ) \ 01160 ( face->face_flags & FT_FACE_FLAG_SFNT ) 01161 01162 01163 /************************************************************************* 01164 * 01165 * @macro: 01166 * FT_IS_FIXED_WIDTH( face ) 01167 * 01168 * @description: 01169 * A macro that returns true whenever a face object contains a font face 01170 * that contains fixed-width (or `monospace', `fixed-pitch', etc.) 01171 * glyphs. 01172 * 01173 */ 01174 #define FT_IS_FIXED_WIDTH( face ) \ 01175 ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) 01176 01177 01178 /************************************************************************* 01179 * 01180 * @macro: 01181 * FT_HAS_FIXED_SIZES( face ) 01182 * 01183 * @description: 01184 * A macro that returns true whenever a face object contains some 01185 * embedded bitmaps. See the `available_sizes' field of the 01186 * @FT_FaceRec structure. 01187 * 01188 */ 01189 #define FT_HAS_FIXED_SIZES( face ) \ 01190 ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) 01191 01192 01193 /************************************************************************* 01194 * 01195 * @macro: 01196 * FT_HAS_FAST_GLYPHS( face ) 01197 * 01198 * @description: 01199 * Deprecated. 01200 * 01201 */ 01202 #define FT_HAS_FAST_GLYPHS( face ) 0 01203 01204 01205 /************************************************************************* 01206 * 01207 * @macro: 01208 * FT_HAS_GLYPH_NAMES( face ) 01209 * 01210 * @description: 01211 * A macro that returns true whenever a face object contains some glyph 01212 * names that can be accessed through @FT_Get_Glyph_Name. 01213 * 01214 */ 01215 #define FT_HAS_GLYPH_NAMES( face ) \ 01216 ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) 01217 01218 01219 /************************************************************************* 01220 * 01221 * @macro: 01222 * FT_HAS_MULTIPLE_MASTERS( face ) 01223 * 01224 * @description: 01225 * A macro that returns true whenever a face object contains some 01226 * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H 01227 * are then available to choose the exact design you want. 01228 * 01229 */ 01230 #define FT_HAS_MULTIPLE_MASTERS( face ) \ 01231 ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) 01232 01233 01234 /************************************************************************* 01235 * 01236 * @macro: 01237 * FT_IS_CID_KEYED( face ) 01238 * 01239 * @description: 01240 * A macro that returns true whenever a face object contains a CID-keyed 01241 * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more 01242 * details. 01243 * 01244 * If this macro is true, all functions defined in @FT_CID_H are 01245 * available. 01246 * 01247 */ 01248 #define FT_IS_CID_KEYED( face ) \ 01249 ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) 01250 01251 01252 /************************************************************************* 01253 * 01254 * @macro: 01255 * FT_IS_TRICKY( face ) 01256 * 01257 * @description: 01258 * A macro that returns true whenever a face represents a `tricky' font. 01259 * See the discussion of @FT_FACE_FLAG_TRICKY for more details. 01260 * 01261 */ 01262 #define FT_IS_TRICKY( face ) \ 01263 ( face->face_flags & FT_FACE_FLAG_TRICKY ) 01264 01265 01266 /*************************************************************************/ 01267 /* */ 01268 /* <Const> */ 01269 /* FT_STYLE_FLAG_XXX */ 01270 /* */ 01271 /* <Description> */ 01272 /* A list of bit-flags used to indicate the style of a given face. */ 01273 /* These are used in the `style_flags' field of @FT_FaceRec. */ 01274 /* */ 01275 /* <Values> */ 01276 /* FT_STYLE_FLAG_ITALIC :: */ 01277 /* Indicates that a given face style is italic or oblique. */ 01278 /* */ 01279 /* FT_STYLE_FLAG_BOLD :: */ 01280 /* Indicates that a given face is bold. */ 01281 /* */ 01282 /* <Note> */ 01283 /* The style information as provided by FreeType is very basic. More */ 01284 /* details are beyond the scope and should be done on a higher level */ 01285 /* (for example, by analyzing various fields of the `OS/2' table in */ 01286 /* SFNT based fonts). */ 01287 /* */ 01288 #define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) 01289 #define FT_STYLE_FLAG_BOLD ( 1 << 1 ) 01290 01291 01292 /*************************************************************************/ 01293 /* */ 01294 /* <Type> */ 01295 /* FT_Size_Internal */ 01296 /* */ 01297 /* <Description> */ 01298 /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ 01299 /* model private data of a given @FT_Size object. */ 01300 /* */ 01301 typedef struct FT_Size_InternalRec_* FT_Size_Internal; 01302 01303 01304 /*************************************************************************/ 01305 /* */ 01306 /* <Struct> */ 01307 /* FT_Size_Metrics */ 01308 /* */ 01309 /* <Description> */ 01310 /* The size metrics structure gives the metrics of a size object. */ 01311 /* */ 01312 /* <Fields> */ 01313 /* x_ppem :: The width of the scaled EM square in pixels, hence */ 01314 /* the term `ppem' (pixels per EM). It is also */ 01315 /* referred to as `nominal width'. */ 01316 /* */ 01317 /* y_ppem :: The height of the scaled EM square in pixels, */ 01318 /* hence the term `ppem' (pixels per EM). It is also */ 01319 /* referred to as `nominal height'. */ 01320 /* */ 01321 /* x_scale :: A 16.16 fractional scaling value used to convert */ 01322 /* horizontal metrics from font units to 26.6 */ 01323 /* fractional pixels. Only relevant for scalable */ 01324 /* font formats. */ 01325 /* */ 01326 /* y_scale :: A 16.16 fractional scaling value used to convert */ 01327 /* vertical metrics from font units to 26.6 */ 01328 /* fractional pixels. Only relevant for scalable */ 01329 /* font formats. */ 01330 /* */ 01331 /* ascender :: The ascender in 26.6 fractional pixels. See */ 01332 /* @FT_FaceRec for the details. */ 01333 /* */ 01334 /* descender :: The descender in 26.6 fractional pixels. See */ 01335 /* @FT_FaceRec for the details. */ 01336 /* */ 01337 /* height :: The height in 26.6 fractional pixels. See */ 01338 /* @FT_FaceRec for the details. */ 01339 /* */ 01340 /* max_advance :: The maximal advance width in 26.6 fractional */ 01341 /* pixels. See @FT_FaceRec for the details. */ 01342 /* */ 01343 /* <Note> */ 01344 /* The scaling values, if relevant, are determined first during a */ 01345 /* size changing operation. The remaining fields are then set by the */ 01346 /* driver. For scalable formats, they are usually set to scaled */ 01347 /* values of the corresponding fields in @FT_FaceRec. */ 01348 /* */ 01349 /* Note that due to glyph hinting, these values might not be exact */ 01350 /* for certain fonts. Thus they must be treated as unreliable */ 01351 /* with an error margin of at least one pixel! */ 01352 /* */ 01353 /* Indeed, the only way to get the exact metrics is to render _all_ */ 01354 /* glyphs. As this would be a definite performance hit, it is up to */ 01355 /* client applications to perform such computations. */ 01356 /* */ 01357 /* The FT_Size_Metrics structure is valid for bitmap fonts also. */ 01358 /* */ 01359 typedef struct FT_Size_Metrics_ 01360 { 01361 FT_UShort x_ppem; /* horizontal pixels per EM */ 01362 FT_UShort y_ppem; /* vertical pixels per EM */ 01363 01364 FT_Fixed x_scale; /* scaling values used to convert font */ 01365 FT_Fixed y_scale; /* units to 26.6 fractional pixels */ 01366 01367 FT_Pos ascender; /* ascender in 26.6 frac. pixels */ 01368 FT_Pos descender; /* descender in 26.6 frac. pixels */ 01369 FT_Pos height; /* text height in 26.6 frac. pixels */ 01370 FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ 01371 01372 } FT_Size_Metrics; 01373 01374 01375 /*************************************************************************/ 01376 /* */ 01377 /* <Struct> */ 01378 /* FT_SizeRec */ 01379 /* */ 01380 /* <Description> */ 01381 /* FreeType root size class structure. A size object models a face */ 01382 /* object at a given size. */ 01383 /* */ 01384 /* <Fields> */ 01385 /* face :: Handle to the parent face object. */ 01386 /* */ 01387 /* generic :: A typeless pointer, which is unused by the FreeType */ 01388 /* library or any of its drivers. It can be used by */ 01389 /* client applications to link their own data to each size */ 01390 /* object. */ 01391 /* */ 01392 /* metrics :: Metrics for this size object. This field is read-only. */ 01393 /* */ 01394 typedef struct FT_SizeRec_ 01395 { 01396 FT_Face face; /* parent face object */ 01397 FT_Generic generic; /* generic pointer for client uses */ 01398 FT_Size_Metrics metrics; /* size metrics */ 01399 FT_Size_Internal internal; 01400 01401 } FT_SizeRec; 01402 01403 01404 /*************************************************************************/ 01405 /* */ 01406 /* <Struct> */ 01407 /* FT_SubGlyph */ 01408 /* */ 01409 /* <Description> */ 01410 /* The subglyph structure is an internal object used to describe */ 01411 /* subglyphs (for example, in the case of composites). */ 01412 /* */ 01413 /* <Note> */ 01414 /* The subglyph implementation is not part of the high-level API, */ 01415 /* hence the forward structure declaration. */ 01416 /* */ 01417 /* You can however retrieve subglyph information with */ 01418 /* @FT_Get_SubGlyph_Info. */ 01419 /* */ 01420 typedef struct FT_SubGlyphRec_* FT_SubGlyph; 01421 01422 01423 /*************************************************************************/ 01424 /* */ 01425 /* <Type> */ 01426 /* FT_Slot_Internal */ 01427 /* */ 01428 /* <Description> */ 01429 /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ 01430 /* model private data of a given @FT_GlyphSlot object. */ 01431 /* */ 01432 typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; 01433 01434 01435 /*************************************************************************/ 01436 /* */ 01437 /* <Struct> */ 01438 /* FT_GlyphSlotRec */ 01439 /* */ 01440 /* <Description> */ 01441 /* FreeType root glyph slot class structure. A glyph slot is a */ 01442 /* container where individual glyphs can be loaded, be they in */ 01443 /* outline or bitmap format. */ 01444 /* */ 01445 /* <Fields> */ 01446 /* library :: A handle to the FreeType library instance */ 01447 /* this slot belongs to. */ 01448 /* */ 01449 /* face :: A handle to the parent face object. */ 01450 /* */ 01451 /* next :: In some cases (like some font tools), several */ 01452 /* glyph slots per face object can be a good */ 01453 /* thing. As this is rare, the glyph slots are */ 01454 /* listed through a direct, single-linked list */ 01455 /* using its `next' field. */ 01456 /* */ 01457 /* generic :: A typeless pointer which is unused by the */ 01458 /* FreeType library or any of its drivers. It */ 01459 /* can be used by client applications to link */ 01460 /* their own data to each glyph slot object. */ 01461 /* */ 01462 /* metrics :: The metrics of the last loaded glyph in the */ 01463 /* slot. The returned values depend on the last */ 01464 /* load flags (see the @FT_Load_Glyph API */ 01465 /* function) and can be expressed either in 26.6 */ 01466 /* fractional pixels or font units. */ 01467 /* */ 01468 /* Note that even when the glyph image is */ 01469 /* transformed, the metrics are not. */ 01470 /* */ 01471 /* linearHoriAdvance :: The advance width of the unhinted glyph. */ 01472 /* Its value is expressed in 16.16 fractional */ 01473 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ 01474 /* when loading the glyph. This field can be */ 01475 /* important to perform correct WYSIWYG layout. */ 01476 /* Only relevant for outline glyphs. */ 01477 /* */ 01478 /* linearVertAdvance :: The advance height of the unhinted glyph. */ 01479 /* Its value is expressed in 16.16 fractional */ 01480 /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ 01481 /* when loading the glyph. This field can be */ 01482 /* important to perform correct WYSIWYG layout. */ 01483 /* Only relevant for outline glyphs. */ 01484 /* */ 01485 /* advance :: This shorthand is, depending on */ 01486 /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ 01487 /* advance width for the glyph (in 26.6 */ 01488 /* fractional pixel format). As specified with */ 01489 /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ 01490 /* `horiAdvance' or the `vertAdvance' value of */ 01491 /* `metrics' field. */ 01492 /* */ 01493 /* format :: This field indicates the format of the image */ 01494 /* contained in the glyph slot. Typically */ 01495 /* @FT_GLYPH_FORMAT_BITMAP, */ 01496 /* @FT_GLYPH_FORMAT_OUTLINE, or */ 01497 /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */ 01498 /* possible. */ 01499 /* */ 01500 /* bitmap :: This field is used as a bitmap descriptor */ 01501 /* when the slot format is */ 01502 /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ 01503 /* address and content of the bitmap buffer can */ 01504 /* change between calls of @FT_Load_Glyph and a */ 01505 /* few other functions. */ 01506 /* */ 01507 /* bitmap_left :: This is the bitmap's left bearing expressed */ 01508 /* in integer pixels. Of course, this is only */ 01509 /* valid if the format is */ 01510 /* @FT_GLYPH_FORMAT_BITMAP. */ 01511 /* */ 01512 /* bitmap_top :: This is the bitmap's top bearing expressed in */ 01513 /* integer pixels. Remember that this is the */ 01514 /* distance from the baseline to the top-most */ 01515 /* glyph scanline, upwards y~coordinates being */ 01516 /* *positive*. */ 01517 /* */ 01518 /* outline :: The outline descriptor for the current glyph */ 01519 /* image if its format is */ 01520 /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ 01521 /* loaded, `outline' can be transformed, */ 01522 /* distorted, embolded, etc. However, it must */ 01523 /* not be freed. */ 01524 /* */ 01525 /* num_subglyphs :: The number of subglyphs in a composite glyph. */ 01526 /* This field is only valid for the composite */ 01527 /* glyph format that should normally only be */ 01528 /* loaded with the @FT_LOAD_NO_RECURSE flag. */ 01529 /* For now this is internal to FreeType. */ 01530 /* */ 01531 /* subglyphs :: An array of subglyph descriptors for */ 01532 /* composite glyphs. There are `num_subglyphs' */ 01533 /* elements in there. Currently internal to */ 01534 /* FreeType. */ 01535 /* */ 01536 /* control_data :: Certain font drivers can also return the */ 01537 /* control data for a given glyph image (e.g. */ 01538 /* TrueType bytecode, Type~1 charstrings, etc.). */ 01539 /* This field is a pointer to such data. */ 01540 /* */ 01541 /* control_len :: This is the length in bytes of the control */ 01542 /* data. */ 01543 /* */ 01544 /* other :: Really wicked formats can use this pointer to */ 01545 /* present their own glyph image to client */ 01546 /* applications. Note that the application */ 01547 /* needs to know about the image format. */ 01548 /* */ 01549 /* lsb_delta :: The difference between hinted and unhinted */ 01550 /* left side bearing while autohinting is */ 01551 /* active. Zero otherwise. */ 01552 /* */ 01553 /* rsb_delta :: The difference between hinted and unhinted */ 01554 /* right side bearing while autohinting is */ 01555 /* active. Zero otherwise. */ 01556 /* */ 01557 /* <Note> */ 01558 /* If @FT_Load_Glyph is called with default flags (see */ 01559 /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ 01560 /* its native format (e.g., an outline glyph for TrueType and Type~1 */ 01561 /* formats). */ 01562 /* */ 01563 /* This image can later be converted into a bitmap by calling */ 01564 /* @FT_Render_Glyph. This function finds the current renderer for */ 01565 /* the native image's format, then invokes it. */ 01566 /* */ 01567 /* The renderer is in charge of transforming the native image through */ 01568 /* the slot's face transformation fields, then converting it into a */ 01569 /* bitmap that is returned in `slot->bitmap'. */ 01570 /* */ 01571 /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ 01572 /* to specify the position of the bitmap relative to the current pen */ 01573 /* position (e.g., coordinates (0,0) on the baseline). Of course, */ 01574 /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ 01575 /* */ 01576 /* <Note> */ 01577 /* Here a small pseudo code fragment which shows how to use */ 01578 /* `lsb_delta' and `rsb_delta': */ 01579 /* */ 01580 /* { */ 01581 /* FT_Pos origin_x = 0; */ 01582 /* FT_Pos prev_rsb_delta = 0; */ 01583 /* */ 01584 /* */ 01585 /* for all glyphs do */ 01586 /* <compute kern between current and previous glyph and add it to */ 01587 /* `origin_x'> */ 01588 /* */ 01589 /* <load glyph with `FT_Load_Glyph'> */ 01590 /* */ 01591 /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ 01592 /* origin_x -= 64; */ 01593 /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ 01594 /* origin_x += 64; */ 01595 /* */ 01596 /* prev_rsb_delta = face->glyph->rsb_delta; */ 01597 /* */ 01598 /* <save glyph image, or render glyph, or ...> */ 01599 /* */ 01600 /* origin_x += face->glyph->advance.x; */ 01601 /* endfor */ 01602 /* } */ 01603 /* */ 01604 typedef struct FT_GlyphSlotRec_ 01605 { 01606 FT_Library library; 01607 FT_Face face; 01608 FT_GlyphSlot next; 01609 FT_UInt reserved; /* retained for binary compatibility */ 01610 FT_Generic generic; 01611 01612 FT_Glyph_Metrics metrics; 01613 FT_Fixed linearHoriAdvance; 01614 FT_Fixed linearVertAdvance; 01615 FT_Vector advance; 01616 01617 FT_Glyph_Format format; 01618 01619 FT_Bitmap bitmap; 01620 FT_Int bitmap_left; 01621 FT_Int bitmap_top; 01622 01623 FT_Outline outline; 01624 01625 FT_UInt num_subglyphs; 01626 FT_SubGlyph subglyphs; 01627 01628 void* control_data; 01629 long control_len; 01630 01631 FT_Pos lsb_delta; 01632 FT_Pos rsb_delta; 01633 01634 void* other; 01635 01636 FT_Slot_Internal internal; 01637 01638 } FT_GlyphSlotRec; 01639 01640 01641 /*************************************************************************/ 01642 /*************************************************************************/ 01643 /* */ 01644 /* F U N C T I O N S */ 01645 /* */ 01646 /*************************************************************************/ 01647 /*************************************************************************/ 01648 01649 01650 /*************************************************************************/ 01651 /* */ 01652 /* <Function> */ 01653 /* FT_Init_FreeType */ 01654 /* */ 01655 /* <Description> */ 01656 /* Initialize a new FreeType library object. The set of modules */ 01657 /* that are registered by this function is determined at build time. */ 01658 /* */ 01659 /* <Output> */ 01660 /* alibrary :: A handle to a new library object. */ 01661 /* */ 01662 /* <Return> */ 01663 /* FreeType error code. 0~means success. */ 01664 /* */ 01665 /* <Note> */ 01666 /* In case you want to provide your own memory allocating routines, */ 01667 /* use @FT_New_Library instead, followed by a call to */ 01668 /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ 01669 /* */ 01670 FT_EXPORT( FT_Error ) 01671 FT_Init_FreeType( FT_Library *alibrary ); 01672 01673 01674 /*************************************************************************/ 01675 /* */ 01676 /* <Function> */ 01677 /* FT_Done_FreeType */ 01678 /* */ 01679 /* <Description> */ 01680 /* Destroy a given FreeType library object and all of its children, */ 01681 /* including resources, drivers, faces, sizes, etc. */ 01682 /* */ 01683 /* <Input> */ 01684 /* library :: A handle to the target library object. */ 01685 /* */ 01686 /* <Return> */ 01687 /* FreeType error code. 0~means success. */ 01688 /* */ 01689 FT_EXPORT( FT_Error ) 01690 FT_Done_FreeType( FT_Library library ); 01691 01692 01693 /*************************************************************************/ 01694 /* */ 01695 /* <Enum> */ 01696 /* FT_OPEN_XXX */ 01697 /* */ 01698 /* <Description> */ 01699 /* A list of bit-field constants used within the `flags' field of the */ 01700 /* @FT_Open_Args structure. */ 01701 /* */ 01702 /* <Values> */ 01703 /* FT_OPEN_MEMORY :: This is a memory-based stream. */ 01704 /* */ 01705 /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ 01706 /* */ 01707 /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ 01708 /* name. */ 01709 /* */ 01710 /* FT_OPEN_DRIVER :: Use the `driver' field. */ 01711 /* */ 01712 /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ 01713 /* */ 01714 /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ 01715 /* */ 01716 /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ 01717 /* */ 01718 /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ 01719 /* */ 01720 /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ 01721 /* */ 01722 /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ 01723 /* */ 01724 /* <Note> */ 01725 /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ 01726 /* flags are mutually exclusive. */ 01727 /* */ 01728 #define FT_OPEN_MEMORY 0x1 01729 #define FT_OPEN_STREAM 0x2 01730 #define FT_OPEN_PATHNAME 0x4 01731 #define FT_OPEN_DRIVER 0x8 01732 #define FT_OPEN_PARAMS 0x10 01733 01734 #define ft_open_memory FT_OPEN_MEMORY /* deprecated */ 01735 #define ft_open_stream FT_OPEN_STREAM /* deprecated */ 01736 #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ 01737 #define ft_open_driver FT_OPEN_DRIVER /* deprecated */ 01738 #define ft_open_params FT_OPEN_PARAMS /* deprecated */ 01739 01740 01741 /*************************************************************************/ 01742 /* */ 01743 /* <Struct> */ 01744 /* FT_Parameter */ 01745 /* */ 01746 /* <Description> */ 01747 /* A simple structure used to pass more or less generic parameters to */ 01748 /* @FT_Open_Face. */ 01749 /* */ 01750 /* <Fields> */ 01751 /* tag :: A four-byte identification tag. */ 01752 /* */ 01753 /* data :: A pointer to the parameter data. */ 01754 /* */ 01755 /* <Note> */ 01756 /* The ID and function of parameters are driver-specific. See the */ 01757 /* various FT_PARAM_TAG_XXX flags for more information. */ 01758 /* */ 01759 typedef struct FT_Parameter_ 01760 { 01761 FT_ULong tag; 01762 FT_Pointer data; 01763 01764 } FT_Parameter; 01765 01766 01767 /*************************************************************************/ 01768 /* */ 01769 /* <Struct> */ 01770 /* FT_Open_Args */ 01771 /* */ 01772 /* <Description> */ 01773 /* A structure used to indicate how to open a new font file or */ 01774 /* stream. A pointer to such a structure can be used as a parameter */ 01775 /* for the functions @FT_Open_Face and @FT_Attach_Stream. */ 01776 /* */ 01777 /* <Fields> */ 01778 /* flags :: A set of bit flags indicating how to use the */ 01779 /* structure. */ 01780 /* */ 01781 /* memory_base :: The first byte of the file in memory. */ 01782 /* */ 01783 /* memory_size :: The size in bytes of the file in memory. */ 01784 /* */ 01785 /* pathname :: A pointer to an 8-bit file pathname. */ 01786 /* */ 01787 /* stream :: A handle to a source stream object. */ 01788 /* */ 01789 /* driver :: This field is exclusively used by @FT_Open_Face; */ 01790 /* it simply specifies the font driver to use to open */ 01791 /* the face. If set to~0, FreeType tries to load the */ 01792 /* face with each one of the drivers in its list. */ 01793 /* */ 01794 /* num_params :: The number of extra parameters. */ 01795 /* */ 01796 /* params :: Extra parameters passed to the font driver when */ 01797 /* opening a new face. */ 01798 /* */ 01799 /* <Note> */ 01800 /* The stream type is determined by the contents of `flags' which */ 01801 /* are tested in the following order by @FT_Open_Face: */ 01802 /* */ 01803 /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ 01804 /* memory file of `memory_size' bytes, located at `memory_address'. */ 01805 /* The data are are not copied, and the client is responsible for */ 01806 /* releasing and destroying them _after_ the corresponding call to */ 01807 /* @FT_Done_Face. */ 01808 /* */ 01809 /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ 01810 /* custom input stream `stream' is used. */ 01811 /* */ 01812 /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ 01813 /* is a normal file and use `pathname' to open it. */ 01814 /* */ 01815 /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */ 01816 /* open the file with the driver whose handler is in `driver'. */ 01817 /* */ 01818 /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ 01819 /* `num_params' and `params' is used. They are ignored otherwise. */ 01820 /* */ 01821 /* Ideally, both the `pathname' and `params' fields should be tagged */ 01822 /* as `const'; this is missing for API backwards compatibility. In */ 01823 /* other words, applications should treat them as read-only. */ 01824 /* */ 01825 typedef struct FT_Open_Args_ 01826 { 01827 FT_UInt flags; 01828 const FT_Byte* memory_base; 01829 FT_Long memory_size; 01830 FT_String* pathname; 01831 FT_Stream stream; 01832 FT_Module driver; 01833 FT_Int num_params; 01834 FT_Parameter* params; 01835 01836 } FT_Open_Args; 01837 01838 01839 /*************************************************************************/ 01840 /* */ 01841 /* <Function> */ 01842 /* FT_New_Face */ 01843 /* */ 01844 /* <Description> */ 01845 /* This function calls @FT_Open_Face to open a font by its pathname. */ 01846 /* */ 01847 /* <InOut> */ 01848 /* library :: A handle to the library resource. */ 01849 /* */ 01850 /* <Input> */ 01851 /* pathname :: A path to the font file. */ 01852 /* */ 01853 /* face_index :: The index of the face within the font. The first */ 01854 /* face has index~0. */ 01855 /* */ 01856 /* <Output> */ 01857 /* aface :: A handle to a new face object. If `face_index' is */ 01858 /* greater than or equal to zero, it must be non-NULL. */ 01859 /* See @FT_Open_Face for more details. */ 01860 /* */ 01861 /* <Return> */ 01862 /* FreeType error code. 0~means success. */ 01863 /* */ 01864 FT_EXPORT( FT_Error ) 01865 FT_New_Face( FT_Library library, 01866 const char* filepathname, 01867 FT_Long face_index, 01868 FT_Face *aface ); 01869 01870 01871 /*************************************************************************/ 01872 /* */ 01873 /* <Function> */ 01874 /* FT_New_Memory_Face */ 01875 /* */ 01876 /* <Description> */ 01877 /* This function calls @FT_Open_Face to open a font which has been */ 01878 /* loaded into memory. */ 01879 /* */ 01880 /* <InOut> */ 01881 /* library :: A handle to the library resource. */ 01882 /* */ 01883 /* <Input> */ 01884 /* file_base :: A pointer to the beginning of the font data. */ 01885 /* */ 01886 /* file_size :: The size of the memory chunk used by the font data. */ 01887 /* */ 01888 /* face_index :: The index of the face within the font. The first */ 01889 /* face has index~0. */ 01890 /* */ 01891 /* <Output> */ 01892 /* aface :: A handle to a new face object. If `face_index' is */ 01893 /* greater than or equal to zero, it must be non-NULL. */ 01894 /* See @FT_Open_Face for more details. */ 01895 /* */ 01896 /* <Return> */ 01897 /* FreeType error code. 0~means success. */ 01898 /* */ 01899 /* <Note> */ 01900 /* You must not deallocate the memory before calling @FT_Done_Face. */ 01901 /* */ 01902 FT_EXPORT( FT_Error ) 01903 FT_New_Memory_Face( FT_Library library, 01904 const FT_Byte* file_base, 01905 FT_Long file_size, 01906 FT_Long face_index, 01907 FT_Face *aface ); 01908 01909 01910 /*************************************************************************/ 01911 /* */ 01912 /* <Function> */ 01913 /* FT_Open_Face */ 01914 /* */ 01915 /* <Description> */ 01916 /* Create a face object from a given resource described by */ 01917 /* @FT_Open_Args. */ 01918 /* */ 01919 /* <InOut> */ 01920 /* library :: A handle to the library resource. */ 01921 /* */ 01922 /* <Input> */ 01923 /* args :: A pointer to an `FT_Open_Args' structure which must */ 01924 /* be filled by the caller. */ 01925 /* */ 01926 /* face_index :: The index of the face within the font. The first */ 01927 /* face has index~0. */ 01928 /* */ 01929 /* <Output> */ 01930 /* aface :: A handle to a new face object. If `face_index' is */ 01931 /* greater than or equal to zero, it must be non-NULL. */ 01932 /* See note below. */ 01933 /* */ 01934 /* <Return> */ 01935 /* FreeType error code. 0~means success. */ 01936 /* */ 01937 /* <Note> */ 01938 /* Unlike FreeType 1.x, this function automatically creates a glyph */ 01939 /* slot for the face object which can be accessed directly through */ 01940 /* `face->glyph'. */ 01941 /* */ 01942 /* FT_Open_Face can be used to quickly check whether the font */ 01943 /* format of a given font resource is supported by FreeType. If the */ 01944 /* `face_index' field is negative, the function's return value is~0 */ 01945 /* if the font format is recognized, or non-zero otherwise; */ 01946 /* the function returns a more or less empty face handle in `*aface' */ 01947 /* (if `aface' isn't NULL). The only useful field in this special */ 01948 /* case is `face->num_faces' which gives the number of faces within */ 01949 /* the font file. After examination, the returned @FT_Face structure */ 01950 /* should be deallocated with a call to @FT_Done_Face. */ 01951 /* */ 01952 /* Each new face object created with this function also owns a */ 01953 /* default @FT_Size object, accessible as `face->size'. */ 01954 /* */ 01955 FT_EXPORT( FT_Error ) 01956 FT_Open_Face( FT_Library library, 01957 const FT_Open_Args* args, 01958 FT_Long face_index, 01959 FT_Face *aface ); 01960 01961 01962 /*************************************************************************/ 01963 /* */ 01964 /* <Function> */ 01965 /* FT_Attach_File */ 01966 /* */ 01967 /* <Description> */ 01968 /* This function calls @FT_Attach_Stream to attach a file. */ 01969 /* */ 01970 /* <InOut> */ 01971 /* face :: The target face object. */ 01972 /* */ 01973 /* <Input> */ 01974 /* filepathname :: The pathname. */ 01975 /* */ 01976 /* <Return> */ 01977 /* FreeType error code. 0~means success. */ 01978 /* */ 01979 FT_EXPORT( FT_Error ) 01980 FT_Attach_File( FT_Face face, 01981 const char* filepathname ); 01982 01983 01984 /*************************************************************************/ 01985 /* */ 01986 /* <Function> */ 01987 /* FT_Attach_Stream */ 01988 /* */ 01989 /* <Description> */ 01990 /* `Attach' data to a face object. Normally, this is used to read */ 01991 /* additional information for the face object. For example, you can */ 01992 /* attach an AFM file that comes with a Type~1 font to get the */ 01993 /* kerning values and other metrics. */ 01994 /* */ 01995 /* <InOut> */ 01996 /* face :: The target face object. */ 01997 /* */ 01998 /* <Input> */ 01999 /* parameters :: A pointer to @FT_Open_Args which must be filled by */ 02000 /* the caller. */ 02001 /* */ 02002 /* <Return> */ 02003 /* FreeType error code. 0~means success. */ 02004 /* */ 02005 /* <Note> */ 02006 /* The meaning of the `attach' (i.e., what really happens when the */ 02007 /* new file is read) is not fixed by FreeType itself. It really */ 02008 /* depends on the font format (and thus the font driver). */ 02009 /* */ 02010 /* Client applications are expected to know what they are doing */ 02011 /* when invoking this function. Most drivers simply do not implement */ 02012 /* file attachments. */ 02013 /* */ 02014 FT_EXPORT( FT_Error ) 02015 FT_Attach_Stream( FT_Face face, 02016 FT_Open_Args* parameters ); 02017 02018 02019 /*************************************************************************/ 02020 /* */ 02021 /* <Function> */ 02022 /* FT_Done_Face */ 02023 /* */ 02024 /* <Description> */ 02025 /* Discard a given face object, as well as all of its child slots and */ 02026 /* sizes. */ 02027 /* */ 02028 /* <Input> */ 02029 /* face :: A handle to a target face object. */ 02030 /* */ 02031 /* <Return> */ 02032 /* FreeType error code. 0~means success. */ 02033 /* */ 02034 FT_EXPORT( FT_Error ) 02035 FT_Done_Face( FT_Face face ); 02036 02037 02038 /*************************************************************************/ 02039 /* */ 02040 /* <Function> */ 02041 /* FT_Select_Size */ 02042 /* */ 02043 /* <Description> */ 02044 /* Select a bitmap strike. */ 02045 /* */ 02046 /* <InOut> */ 02047 /* face :: A handle to a target face object. */ 02048 /* */ 02049 /* <Input> */ 02050 /* strike_index :: The index of the bitmap strike in the */ 02051 /* `available_sizes' field of @FT_FaceRec structure. */ 02052 /* */ 02053 /* <Return> */ 02054 /* FreeType error code. 0~means success. */ 02055 /* */ 02056 FT_EXPORT( FT_Error ) 02057 FT_Select_Size( FT_Face face, 02058 FT_Int strike_index ); 02059 02060 02061 /*************************************************************************/ 02062 /* */ 02063 /* <Enum> */ 02064 /* FT_Size_Request_Type */ 02065 /* */ 02066 /* <Description> */ 02067 /* An enumeration type that lists the supported size request types. */ 02068 /* */ 02069 /* <Values> */ 02070 /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ 02071 /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ 02072 /* used to determine both scaling values. */ 02073 /* */ 02074 /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ 02075 /* The real dimension. The sum of the the `Ascender' and (minus */ 02076 /* of) the `Descender' fields of @FT_FaceRec are used to determine */ 02077 /* both scaling values. */ 02078 /* */ 02079 /* FT_SIZE_REQUEST_TYPE_BBOX :: */ 02080 /* The font bounding box. The width and height of the `bbox' field */ 02081 /* of @FT_FaceRec are used to determine the horizontal and vertical */ 02082 /* scaling value, respectively. */ 02083 /* */ 02084 /* FT_SIZE_REQUEST_TYPE_CELL :: */ 02085 /* The `max_advance_width' field of @FT_FaceRec is used to */ 02086 /* determine the horizontal scaling value; the vertical scaling */ 02087 /* value is determined the same way as */ 02088 /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ 02089 /* values are set to the smaller one. This type is useful if you */ 02090 /* want to specify the font size for, say, a window of a given */ 02091 /* dimension and 80x24 cells. */ 02092 /* */ 02093 /* FT_SIZE_REQUEST_TYPE_SCALES :: */ 02094 /* Specify the scaling values directly. */ 02095 /* */ 02096 /* <Note> */ 02097 /* The above descriptions only apply to scalable formats. For bitmap */ 02098 /* formats, the behaviour is up to the driver. */ 02099 /* */ 02100 /* See the note section of @FT_Size_Metrics if you wonder how size */ 02101 /* requesting relates to scaling values. */ 02102 /* */ 02103 typedef enum FT_Size_Request_Type_ 02104 { 02105 FT_SIZE_REQUEST_TYPE_NOMINAL, 02106 FT_SIZE_REQUEST_TYPE_REAL_DIM, 02107 FT_SIZE_REQUEST_TYPE_BBOX, 02108 FT_SIZE_REQUEST_TYPE_CELL, 02109 FT_SIZE_REQUEST_TYPE_SCALES, 02110 02111 FT_SIZE_REQUEST_TYPE_MAX 02112 02113 } FT_Size_Request_Type; 02114 02115 02116 /*************************************************************************/ 02117 /* */ 02118 /* <Struct> */ 02119 /* FT_Size_RequestRec */ 02120 /* */ 02121 /* <Description> */ 02122 /* A structure used to model a size request. */ 02123 /* */ 02124 /* <Fields> */ 02125 /* type :: See @FT_Size_Request_Type. */ 02126 /* */ 02127 /* width :: The desired width. */ 02128 /* */ 02129 /* height :: The desired height. */ 02130 /* */ 02131 /* horiResolution :: The horizontal resolution. If set to zero, */ 02132 /* `width' is treated as a 26.6 fractional pixel */ 02133 /* value. */ 02134 /* */ 02135 /* vertResolution :: The vertical resolution. If set to zero, */ 02136 /* `height' is treated as a 26.6 fractional pixel */ 02137 /* value. */ 02138 /* */ 02139 /* <Note> */ 02140 /* If `width' is zero, then the horizontal scaling value is set equal */ 02141 /* to the vertical scaling value, and vice versa. */ 02142 /* */ 02143 typedef struct FT_Size_RequestRec_ 02144 { 02145 FT_Size_Request_Type type; 02146 FT_Long width; 02147 FT_Long height; 02148 FT_UInt horiResolution; 02149 FT_UInt vertResolution; 02150 02151 } FT_Size_RequestRec; 02152 02153 02154 /*************************************************************************/ 02155 /* */ 02156 /* <Struct> */ 02157 /* FT_Size_Request */ 02158 /* */ 02159 /* <Description> */ 02160 /* A handle to a size request structure. */ 02161 /* */ 02162 typedef struct FT_Size_RequestRec_ *FT_Size_Request; 02163 02164 02165 /*************************************************************************/ 02166 /* */ 02167 /* <Function> */ 02168 /* FT_Request_Size */ 02169 /* */ 02170 /* <Description> */ 02171 /* Resize the scale of the active @FT_Size object in a face. */ 02172 /* */ 02173 /* <InOut> */ 02174 /* face :: A handle to a target face object. */ 02175 /* */ 02176 /* <Input> */ 02177 /* req :: A pointer to a @FT_Size_RequestRec. */ 02178 /* */ 02179 /* <Return> */ 02180 /* FreeType error code. 0~means success. */ 02181 /* */ 02182 /* <Note> */ 02183 /* Although drivers may select the bitmap strike matching the */ 02184 /* request, you should not rely on this if you intend to select a */ 02185 /* particular bitmap strike. Use @FT_Select_Size instead in that */ 02186 /* case. */ 02187 /* */ 02188 FT_EXPORT( FT_Error ) 02189 FT_Request_Size( FT_Face face, 02190 FT_Size_Request req ); 02191 02192 02193 /*************************************************************************/ 02194 /* */ 02195 /* <Function> */ 02196 /* FT_Set_Char_Size */ 02197 /* */ 02198 /* <Description> */ 02199 /* This function calls @FT_Request_Size to request the nominal size */ 02200 /* (in points). */ 02201 /* */ 02202 /* <InOut> */ 02203 /* face :: A handle to a target face object. */ 02204 /* */ 02205 /* <Input> */ 02206 /* char_width :: The nominal width, in 26.6 fractional points. */ 02207 /* */ 02208 /* char_height :: The nominal height, in 26.6 fractional points. */ 02209 /* */ 02210 /* horz_resolution :: The horizontal resolution in dpi. */ 02211 /* */ 02212 /* vert_resolution :: The vertical resolution in dpi. */ 02213 /* */ 02214 /* <Return> */ 02215 /* FreeType error code. 0~means success. */ 02216 /* */ 02217 /* <Note> */ 02218 /* If either the character width or height is zero, it is set equal */ 02219 /* to the other value. */ 02220 /* */ 02221 /* If either the horizontal or vertical resolution is zero, it is set */ 02222 /* equal to the other value. */ 02223 /* */ 02224 /* A character width or height smaller than 1pt is set to 1pt; if */ 02225 /* both resolution values are zero, they are set to 72dpi. */ 02226 /* */ 02227 /* Don't use this function if you are using the FreeType cache API. */ 02228 /* */ 02229 FT_EXPORT( FT_Error ) 02230 FT_Set_Char_Size( FT_Face face, 02231 FT_F26Dot6 char_width, 02232 FT_F26Dot6 char_height, 02233 FT_UInt horz_resolution, 02234 FT_UInt vert_resolution ); 02235 02236 02237 /*************************************************************************/ 02238 /* */ 02239 /* <Function> */ 02240 /* FT_Set_Pixel_Sizes */ 02241 /* */ 02242 /* <Description> */ 02243 /* This function calls @FT_Request_Size to request the nominal size */ 02244 /* (in pixels). */ 02245 /* */ 02246 /* <InOut> */ 02247 /* face :: A handle to the target face object. */ 02248 /* */ 02249 /* <Input> */ 02250 /* pixel_width :: The nominal width, in pixels. */ 02251 /* */ 02252 /* pixel_height :: The nominal height, in pixels. */ 02253 /* */ 02254 /* <Return> */ 02255 /* FreeType error code. 0~means success. */ 02256 /* */ 02257 FT_EXPORT( FT_Error ) 02258 FT_Set_Pixel_Sizes( FT_Face face, 02259 FT_UInt pixel_width, 02260 FT_UInt pixel_height ); 02261 02262 02263 /*************************************************************************/ 02264 /* */ 02265 /* <Function> */ 02266 /* FT_Load_Glyph */ 02267 /* */ 02268 /* <Description> */ 02269 /* A function used to load a single glyph into the glyph slot of a */ 02270 /* face object. */ 02271 /* */ 02272 /* <InOut> */ 02273 /* face :: A handle to the target face object where the glyph */ 02274 /* is loaded. */ 02275 /* */ 02276 /* <Input> */ 02277 /* glyph_index :: The index of the glyph in the font file. For */ 02278 /* CID-keyed fonts (either in PS or in CFF format) */ 02279 /* this argument specifies the CID value. */ 02280 /* */ 02281 /* load_flags :: A flag indicating what to load for this glyph. The */ 02282 /* @FT_LOAD_XXX constants can be used to control the */ 02283 /* glyph loading process (e.g., whether the outline */ 02284 /* should be scaled, whether to load bitmaps or not, */ 02285 /* whether to hint the outline, etc). */ 02286 /* */ 02287 /* <Return> */ 02288 /* FreeType error code. 0~means success. */ 02289 /* */ 02290 /* <Note> */ 02291 /* The loaded glyph may be transformed. See @FT_Set_Transform for */ 02292 /* the details. */ 02293 /* */ 02294 /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ 02295 /* returned for invalid CID values (this is, for CID values which */ 02296 /* don't have a corresponding glyph in the font). See the discussion */ 02297 /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ 02298 /* */ 02299 FT_EXPORT( FT_Error ) 02300 FT_Load_Glyph( FT_Face face, 02301 FT_UInt glyph_index, 02302 FT_Int32 load_flags ); 02303 02304 02305 /*************************************************************************/ 02306 /* */ 02307 /* <Function> */ 02308 /* FT_Load_Char */ 02309 /* */ 02310 /* <Description> */ 02311 /* A function used to load a single glyph into the glyph slot of a */ 02312 /* face object, according to its character code. */ 02313 /* */ 02314 /* <InOut> */ 02315 /* face :: A handle to a target face object where the glyph */ 02316 /* is loaded. */ 02317 /* */ 02318 /* <Input> */ 02319 /* char_code :: The glyph's character code, according to the */ 02320 /* current charmap used in the face. */ 02321 /* */ 02322 /* load_flags :: A flag indicating what to load for this glyph. The */ 02323 /* @FT_LOAD_XXX constants can be used to control the */ 02324 /* glyph loading process (e.g., whether the outline */ 02325 /* should be scaled, whether to load bitmaps or not, */ 02326 /* whether to hint the outline, etc). */ 02327 /* */ 02328 /* <Return> */ 02329 /* FreeType error code. 0~means success. */ 02330 /* */ 02331 /* <Note> */ 02332 /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ 02333 /* */ 02334 FT_EXPORT( FT_Error ) 02335 FT_Load_Char( FT_Face face, 02336 FT_ULong char_code, 02337 FT_Int32 load_flags ); 02338 02339 02340 /************************************************************************* 02341 * 02342 * @enum: 02343 * FT_LOAD_XXX 02344 * 02345 * @description: 02346 * A list of bit-field constants used with @FT_Load_Glyph to indicate 02347 * what kind of operations to perform during glyph loading. 02348 * 02349 * @values: 02350 * FT_LOAD_DEFAULT :: 02351 * Corresponding to~0, this value is used as the default glyph load 02352 * operation. In this case, the following happens: 02353 * 02354 * 1. FreeType looks for a bitmap for the glyph corresponding to the 02355 * face's current size. If one is found, the function returns. 02356 * The bitmap data can be accessed from the glyph slot (see note 02357 * below). 02358 * 02359 * 2. If no embedded bitmap is searched or found, FreeType looks for a 02360 * scalable outline. If one is found, it is loaded from the font 02361 * file, scaled to device pixels, then `hinted' to the pixel grid 02362 * in order to optimize it. The outline data can be accessed from 02363 * the glyph slot (see note below). 02364 * 02365 * Note that by default, the glyph loader doesn't render outlines into 02366 * bitmaps. The following flags are used to modify this default 02367 * behaviour to more specific and useful cases. 02368 * 02369 * FT_LOAD_NO_SCALE :: 02370 * Don't scale the outline glyph loaded, but keep it in font units. 02371 * 02372 * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and 02373 * unsets @FT_LOAD_RENDER. 02374 * 02375 * FT_LOAD_NO_HINTING :: 02376 * Disable hinting. This generally generates `blurrier' bitmap glyph 02377 * when the glyph is rendered in any of the anti-aliased modes. See 02378 * also the note below. 02379 * 02380 * This flag is implied by @FT_LOAD_NO_SCALE. 02381 * 02382 * FT_LOAD_RENDER :: 02383 * Call @FT_Render_Glyph after the glyph is loaded. By default, the 02384 * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be 02385 * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. 02386 * 02387 * This flag is unset by @FT_LOAD_NO_SCALE. 02388 * 02389 * FT_LOAD_NO_BITMAP :: 02390 * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this 02391 * flag. 02392 * 02393 * @FT_LOAD_NO_SCALE always sets this flag. 02394 * 02395 * FT_LOAD_VERTICAL_LAYOUT :: 02396 * Load the glyph for vertical text layout. _Don't_ use it as it is 02397 * problematic currently. 02398 * 02399 * FT_LOAD_FORCE_AUTOHINT :: 02400 * Indicates that the auto-hinter is preferred over the font's native 02401 * hinter. See also the note below. 02402 * 02403 * FT_LOAD_CROP_BITMAP :: 02404 * Indicates that the font driver should crop the loaded bitmap glyph 02405 * (i.e., remove all space around its black bits). Not all drivers 02406 * implement this. 02407 * 02408 * FT_LOAD_PEDANTIC :: 02409 * Indicates that the font driver should perform pedantic verifications 02410 * during glyph loading. This is mostly used to detect broken glyphs 02411 * in fonts. By default, FreeType tries to handle broken fonts also. 02412 * 02413 * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: 02414 * Indicates that the font driver should ignore the global advance 02415 * width defined in the font. By default, that value is used as the 02416 * advance width for all glyphs when the face has 02417 * @FT_FACE_FLAG_FIXED_WIDTH set. 02418 * 02419 * This flag exists for historical reasons (to support buggy CJK 02420 * fonts). 02421 * 02422 * FT_LOAD_NO_RECURSE :: 02423 * This flag is only used internally. It merely indicates that the 02424 * font driver should not load composite glyphs recursively. Instead, 02425 * it should set the `num_subglyph' and `subglyphs' values of the 02426 * glyph slot accordingly, and set `glyph->format' to 02427 * @FT_GLYPH_FORMAT_COMPOSITE. 02428 * 02429 * The description of sub-glyphs is not available to client 02430 * applications for now. 02431 * 02432 * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. 02433 * 02434 * FT_LOAD_IGNORE_TRANSFORM :: 02435 * Indicates that the transform matrix set by @FT_Set_Transform should 02436 * be ignored. 02437 * 02438 * FT_LOAD_MONOCHROME :: 02439 * This flag is used with @FT_LOAD_RENDER to indicate that you want to 02440 * render an outline glyph to a 1-bit monochrome bitmap glyph, with 02441 * 8~pixels packed into each byte of the bitmap data. 02442 * 02443 * Note that this has no effect on the hinting algorithm used. You 02444 * should rather use @FT_LOAD_TARGET_MONO so that the 02445 * monochrome-optimized hinting algorithm is used. 02446 * 02447 * FT_LOAD_LINEAR_DESIGN :: 02448 * Indicates that the `linearHoriAdvance' and `linearVertAdvance' 02449 * fields of @FT_GlyphSlotRec should be kept in font units. See 02450 * @FT_GlyphSlotRec for details. 02451 * 02452 * FT_LOAD_NO_AUTOHINT :: 02453 * Disable auto-hinter. See also the note below. 02454 * 02455 * @note: 02456 * By default, hinting is enabled and the font's native hinter (see 02457 * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can 02458 * disable hinting by setting @FT_LOAD_NO_HINTING or change the 02459 * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set 02460 * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be 02461 * used at all. 02462 * 02463 * See the description of @FT_FACE_FLAG_TRICKY for a special exception 02464 * (affecting only a handful of Asian fonts). 02465 * 02466 * Besides deciding which hinter to use, you can also decide which 02467 * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. 02468 * 02469 */ 02470 #define FT_LOAD_DEFAULT 0x0 02471 #define FT_LOAD_NO_SCALE 0x1 02472 #define FT_LOAD_NO_HINTING 0x2 02473 #define FT_LOAD_RENDER 0x4 02474 #define FT_LOAD_NO_BITMAP 0x8 02475 #define FT_LOAD_VERTICAL_LAYOUT 0x10 02476 #define FT_LOAD_FORCE_AUTOHINT 0x20 02477 #define FT_LOAD_CROP_BITMAP 0x40 02478 #define FT_LOAD_PEDANTIC 0x80 02479 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200 02480 #define FT_LOAD_NO_RECURSE 0x400 02481 #define FT_LOAD_IGNORE_TRANSFORM 0x800 02482 #define FT_LOAD_MONOCHROME 0x1000 02483 #define FT_LOAD_LINEAR_DESIGN 0x2000 02484 #define FT_LOAD_NO_AUTOHINT 0x8000U 02485 02486 /* */ 02487 02488 /* used internally only by certain font drivers! */ 02489 #define FT_LOAD_ADVANCE_ONLY 0x100 02490 #define FT_LOAD_SBITS_ONLY 0x4000 02491 02492 02493 /************************************************************************** 02494 * 02495 * @enum: 02496 * FT_LOAD_TARGET_XXX 02497 * 02498 * @description: 02499 * A list of values that are used to select a specific hinting algorithm 02500 * to use by the hinter. You should OR one of these values to your 02501 * `load_flags' when calling @FT_Load_Glyph. 02502 * 02503 * Note that font's native hinters may ignore the hinting algorithm you 02504 * have specified (e.g., the TrueType bytecode interpreter). You can set 02505 * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. 02506 * 02507 * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it 02508 * always implies @FT_LOAD_FORCE_AUTOHINT. 02509 * 02510 * @values: 02511 * FT_LOAD_TARGET_NORMAL :: 02512 * This corresponds to the default hinting algorithm, optimized for 02513 * standard gray-level rendering. For monochrome output, use 02514 * @FT_LOAD_TARGET_MONO instead. 02515 * 02516 * FT_LOAD_TARGET_LIGHT :: 02517 * A lighter hinting algorithm for non-monochrome modes. Many 02518 * generated glyphs are more fuzzy but better resemble its original 02519 * shape. A bit like rendering on Mac OS~X. 02520 * 02521 * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT. 02522 * 02523 * FT_LOAD_TARGET_MONO :: 02524 * Strong hinting algorithm that should only be used for monochrome 02525 * output. The result is probably unpleasant if the glyph is rendered 02526 * in non-monochrome modes. 02527 * 02528 * FT_LOAD_TARGET_LCD :: 02529 * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally 02530 * decimated LCD displays. 02531 * 02532 * FT_LOAD_TARGET_LCD_V :: 02533 * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically 02534 * decimated LCD displays. 02535 * 02536 * @note: 02537 * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your 02538 * `load_flags'. They can't be ORed. 02539 * 02540 * If @FT_LOAD_RENDER is also set, the glyph is rendered in the 02541 * corresponding mode (i.e., the mode which matches the used algorithm 02542 * best) unless @FT_LOAD_MONOCHROME is set. 02543 * 02544 * You can use a hinting algorithm that doesn't correspond to the same 02545 * rendering mode. As an example, it is possible to use the `light' 02546 * hinting algorithm and have the results rendered in horizontal LCD 02547 * pixel mode, with code like 02548 * 02549 * { 02550 * FT_Load_Glyph( face, glyph_index, 02551 * load_flags | FT_LOAD_TARGET_LIGHT ); 02552 * 02553 * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); 02554 * } 02555 * 02556 */ 02557 #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) 02558 02559 #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) 02560 #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) 02561 #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) 02562 #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) 02563 #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) 02564 02565 02566 /************************************************************************** 02567 * 02568 * @macro: 02569 * FT_LOAD_TARGET_MODE 02570 * 02571 * @description: 02572 * Return the @FT_Render_Mode corresponding to a given 02573 * @FT_LOAD_TARGET_XXX value. 02574 * 02575 */ 02576 #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) 02577 02578 02579 /*************************************************************************/ 02580 /* */ 02581 /* <Function> */ 02582 /* FT_Set_Transform */ 02583 /* */ 02584 /* <Description> */ 02585 /* A function used to set the transformation that is applied to glyph */ 02586 /* images when they are loaded into a glyph slot through */ 02587 /* @FT_Load_Glyph. */ 02588 /* */ 02589 /* <InOut> */ 02590 /* face :: A handle to the source face object. */ 02591 /* */ 02592 /* <Input> */ 02593 /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */ 02594 /* the identity matrix. */ 02595 /* delta :: A pointer to the translation vector. Use~0 for the null */ 02596 /* vector. */ 02597 /* */ 02598 /* <Note> */ 02599 /* The transformation is only applied to scalable image formats after */ 02600 /* the glyph has been loaded. It means that hinting is unaltered by */ 02601 /* the transformation and is performed on the character size given in */ 02602 /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ 02603 /* */ 02604 /* Note that this also transforms the `face.glyph.advance' field, but */ 02605 /* *not* the values in `face.glyph.metrics'. */ 02606 /* */ 02607 FT_EXPORT( void ) 02608 FT_Set_Transform( FT_Face face, 02609 FT_Matrix* matrix, 02610 FT_Vector* delta ); 02611 02612 02613 /*************************************************************************/ 02614 /* */ 02615 /* <Enum> */ 02616 /* FT_Render_Mode */ 02617 /* */ 02618 /* <Description> */ 02619 /* An enumeration type that lists the render modes supported by */ 02620 /* FreeType~2. Each mode corresponds to a specific type of scanline */ 02621 /* conversion performed on the outline. */ 02622 /* */ 02623 /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ 02624 /* field in the @FT_GlyphSlotRec structure gives the format of the */ 02625 /* returned bitmap. */ 02626 /* */ 02627 /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */ 02628 /* */ 02629 /* <Values> */ 02630 /* FT_RENDER_MODE_NORMAL :: */ 02631 /* This is the default render mode; it corresponds to 8-bit */ 02632 /* anti-aliased bitmaps. */ 02633 /* */ 02634 /* FT_RENDER_MODE_LIGHT :: */ 02635 /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ 02636 /* defined as a separate value because render modes are also used */ 02637 /* indirectly to define hinting algorithm selectors. See */ 02638 /* @FT_LOAD_TARGET_XXX for details. */ 02639 /* */ 02640 /* FT_RENDER_MODE_MONO :: */ 02641 /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ 02642 /* opacity). */ 02643 /* */ 02644 /* FT_RENDER_MODE_LCD :: */ 02645 /* This mode corresponds to horizontal RGB and BGR sub-pixel */ 02646 /* displays like LCD screens. It produces 8-bit bitmaps that are */ 02647 /* 3~times the width of the original glyph outline in pixels, and */ 02648 /* which use the @FT_PIXEL_MODE_LCD mode. */ 02649 /* */ 02650 /* FT_RENDER_MODE_LCD_V :: */ 02651 /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ 02652 /* (like PDA screens, rotated LCD displays, etc.). It produces */ 02653 /* 8-bit bitmaps that are 3~times the height of the original */ 02654 /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ 02655 /* */ 02656 /* <Note> */ 02657 /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ 02658 /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ 02659 /* (not active in the default builds). It is up to the caller to */ 02660 /* either call @FT_Library_SetLcdFilter (if available) or do the */ 02661 /* filtering itself. */ 02662 /* */ 02663 /* The selected render mode only affects vector glyphs of a font. */ 02664 /* Embedded bitmaps often have a different pixel mode like */ 02665 /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ 02666 /* them into 8-bit pixmaps. */ 02667 /* */ 02668 typedef enum FT_Render_Mode_ 02669 { 02670 FT_RENDER_MODE_NORMAL = 0, 02671 FT_RENDER_MODE_LIGHT, 02672 FT_RENDER_MODE_MONO, 02673 FT_RENDER_MODE_LCD, 02674 FT_RENDER_MODE_LCD_V, 02675 02676 FT_RENDER_MODE_MAX 02677 02678 } FT_Render_Mode; 02679 02680 02681 /*************************************************************************/ 02682 /* */ 02683 /* <Enum> */ 02684 /* ft_render_mode_xxx */ 02685 /* */ 02686 /* <Description> */ 02687 /* These constants are deprecated. Use the corresponding */ 02688 /* @FT_Render_Mode values instead. */ 02689 /* */ 02690 /* <Values> */ 02691 /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ 02692 /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ 02693 /* */ 02694 #define ft_render_mode_normal FT_RENDER_MODE_NORMAL 02695 #define ft_render_mode_mono FT_RENDER_MODE_MONO 02696 02697 02698 /*************************************************************************/ 02699 /* */ 02700 /* <Function> */ 02701 /* FT_Render_Glyph */ 02702 /* */ 02703 /* <Description> */ 02704 /* Convert a given glyph image to a bitmap. It does so by inspecting */ 02705 /* the glyph image format, finding the relevant renderer, and */ 02706 /* invoking it. */ 02707 /* */ 02708 /* <InOut> */ 02709 /* slot :: A handle to the glyph slot containing the image to */ 02710 /* convert. */ 02711 /* */ 02712 /* <Input> */ 02713 /* render_mode :: This is the render mode used to render the glyph */ 02714 /* image into a bitmap. See @FT_Render_Mode for a */ 02715 /* list of possible values. */ 02716 /* */ 02717 /* <Return> */ 02718 /* FreeType error code. 0~means success. */ 02719 /* */ 02720 FT_EXPORT( FT_Error ) 02721 FT_Render_Glyph( FT_GlyphSlot slot, 02722 FT_Render_Mode render_mode ); 02723 02724 02725 /*************************************************************************/ 02726 /* */ 02727 /* <Enum> */ 02728 /* FT_Kerning_Mode */ 02729 /* */ 02730 /* <Description> */ 02731 /* An enumeration used to specify which kerning values to return in */ 02732 /* @FT_Get_Kerning. */ 02733 /* */ 02734 /* <Values> */ 02735 /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ 02736 /* distances (value is~0). */ 02737 /* */ 02738 /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ 02739 /* distances. */ 02740 /* */ 02741 /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ 02742 /* units. */ 02743 /* */ 02744 typedef enum FT_Kerning_Mode_ 02745 { 02746 FT_KERNING_DEFAULT = 0, 02747 FT_KERNING_UNFITTED, 02748 FT_KERNING_UNSCALED 02749 02750 } FT_Kerning_Mode; 02751 02752 02753 /*************************************************************************/ 02754 /* */ 02755 /* <Const> */ 02756 /* ft_kerning_default */ 02757 /* */ 02758 /* <Description> */ 02759 /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ 02760 /* instead. */ 02761 /* */ 02762 #define ft_kerning_default FT_KERNING_DEFAULT 02763 02764 02765 /*************************************************************************/ 02766 /* */ 02767 /* <Const> */ 02768 /* ft_kerning_unfitted */ 02769 /* */ 02770 /* <Description> */ 02771 /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ 02772 /* instead. */ 02773 /* */ 02774 #define ft_kerning_unfitted FT_KERNING_UNFITTED 02775 02776 02777 /*************************************************************************/ 02778 /* */ 02779 /* <Const> */ 02780 /* ft_kerning_unscaled */ 02781 /* */ 02782 /* <Description> */ 02783 /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ 02784 /* instead. */ 02785 /* */ 02786 #define ft_kerning_unscaled FT_KERNING_UNSCALED 02787 02788 02789 /*************************************************************************/ 02790 /* */ 02791 /* <Function> */ 02792 /* FT_Get_Kerning */ 02793 /* */ 02794 /* <Description> */ 02795 /* Return the kerning vector between two glyphs of a same face. */ 02796 /* */ 02797 /* <Input> */ 02798 /* face :: A handle to a source face object. */ 02799 /* */ 02800 /* left_glyph :: The index of the left glyph in the kern pair. */ 02801 /* */ 02802 /* right_glyph :: The index of the right glyph in the kern pair. */ 02803 /* */ 02804 /* kern_mode :: See @FT_Kerning_Mode for more information. */ 02805 /* Determines the scale and dimension of the returned */ 02806 /* kerning vector. */ 02807 /* */ 02808 /* <Output> */ 02809 /* akerning :: The kerning vector. This is either in font units */ 02810 /* or in pixels (26.6 format) for scalable formats, */ 02811 /* and in pixels for fixed-sizes formats. */ 02812 /* */ 02813 /* <Return> */ 02814 /* FreeType error code. 0~means success. */ 02815 /* */ 02816 /* <Note> */ 02817 /* Only horizontal layouts (left-to-right & right-to-left) are */ 02818 /* supported by this method. Other layouts, or more sophisticated */ 02819 /* kernings, are out of the scope of this API function -- they can be */ 02820 /* implemented through format-specific interfaces. */ 02821 /* */ 02822 FT_EXPORT( FT_Error ) 02823 FT_Get_Kerning( FT_Face face, 02824 FT_UInt left_glyph, 02825 FT_UInt right_glyph, 02826 FT_UInt kern_mode, 02827 FT_Vector *akerning ); 02828 02829 02830 /*************************************************************************/ 02831 /* */ 02832 /* <Function> */ 02833 /* FT_Get_Track_Kerning */ 02834 /* */ 02835 /* <Description> */ 02836 /* Return the track kerning for a given face object at a given size. */ 02837 /* */ 02838 /* <Input> */ 02839 /* face :: A handle to a source face object. */ 02840 /* */ 02841 /* point_size :: The point size in 16.16 fractional points. */ 02842 /* */ 02843 /* degree :: The degree of tightness. */ 02844 /* */ 02845 /* <Output> */ 02846 /* akerning :: The kerning in 16.16 fractional points. */ 02847 /* */ 02848 /* <Return> */ 02849 /* FreeType error code. 0~means success. */ 02850 /* */ 02851 FT_EXPORT( FT_Error ) 02852 FT_Get_Track_Kerning( FT_Face face, 02853 FT_Fixed point_size, 02854 FT_Int degree, 02855 FT_Fixed* akerning ); 02856 02857 02858 /*************************************************************************/ 02859 /* */ 02860 /* <Function> */ 02861 /* FT_Get_Glyph_Name */ 02862 /* */ 02863 /* <Description> */ 02864 /* Retrieve the ASCII name of a given glyph in a face. This only */ 02865 /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ 02866 /* */ 02867 /* <Input> */ 02868 /* face :: A handle to a source face object. */ 02869 /* */ 02870 /* glyph_index :: The glyph index. */ 02871 /* */ 02872 /* buffer_max :: The maximal number of bytes available in the */ 02873 /* buffer. */ 02874 /* */ 02875 /* <Output> */ 02876 /* buffer :: A pointer to a target buffer where the name is */ 02877 /* copied to. */ 02878 /* */ 02879 /* <Return> */ 02880 /* FreeType error code. 0~means success. */ 02881 /* */ 02882 /* <Note> */ 02883 /* An error is returned if the face doesn't provide glyph names or if */ 02884 /* the glyph index is invalid. In all cases of failure, the first */ 02885 /* byte of `buffer' is set to~0 to indicate an empty name. */ 02886 /* */ 02887 /* The glyph name is truncated to fit within the buffer if it is too */ 02888 /* long. The returned string is always zero-terminated. */ 02889 /* */ 02890 /* This function is not compiled within the library if the config */ 02891 /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ 02892 /* `include/freetype/config/ftoptions.h'. */ 02893 /* */ 02894 FT_EXPORT( FT_Error ) 02895 FT_Get_Glyph_Name( FT_Face face, 02896 FT_UInt glyph_index, 02897 FT_Pointer buffer, 02898 FT_UInt buffer_max ); 02899 02900 02901 /*************************************************************************/ 02902 /* */ 02903 /* <Function> */ 02904 /* FT_Get_Postscript_Name */ 02905 /* */ 02906 /* <Description> */ 02907 /* Retrieve the ASCII PostScript name of a given face, if available. */ 02908 /* This only works with PostScript and TrueType fonts. */ 02909 /* */ 02910 /* <Input> */ 02911 /* face :: A handle to the source face object. */ 02912 /* */ 02913 /* <Return> */ 02914 /* A pointer to the face's PostScript name. NULL if unavailable. */ 02915 /* */ 02916 /* <Note> */ 02917 /* The returned pointer is owned by the face and is destroyed with */ 02918 /* it. */ 02919 /* */ 02920 FT_EXPORT( const char* ) 02921 FT_Get_Postscript_Name( FT_Face face ); 02922 02923 02924 /*************************************************************************/ 02925 /* */ 02926 /* <Function> */ 02927 /* FT_Select_Charmap */ 02928 /* */ 02929 /* <Description> */ 02930 /* Select a given charmap by its encoding tag (as listed in */ 02931 /* `freetype.h'). */ 02932 /* */ 02933 /* <InOut> */ 02934 /* face :: A handle to the source face object. */ 02935 /* */ 02936 /* <Input> */ 02937 /* encoding :: A handle to the selected encoding. */ 02938 /* */ 02939 /* <Return> */ 02940 /* FreeType error code. 0~means success. */ 02941 /* */ 02942 /* <Note> */ 02943 /* This function returns an error if no charmap in the face */ 02944 /* corresponds to the encoding queried here. */ 02945 /* */ 02946 /* Because many fonts contain more than a single cmap for Unicode */ 02947 /* encoding, this function has some special code to select the one */ 02948 /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */ 02949 /* is preferred to a UCS-2 cmap). It is thus preferable to */ 02950 /* @FT_Set_Charmap in this case. */ 02951 /* */ 02952 FT_EXPORT( FT_Error ) 02953 FT_Select_Charmap( FT_Face face, 02954 FT_Encoding encoding ); 02955 02956 02957 /*************************************************************************/ 02958 /* */ 02959 /* <Function> */ 02960 /* FT_Set_Charmap */ 02961 /* */ 02962 /* <Description> */ 02963 /* Select a given charmap for character code to glyph index mapping. */ 02964 /* */ 02965 /* <InOut> */ 02966 /* face :: A handle to the source face object. */ 02967 /* */ 02968 /* <Input> */ 02969 /* charmap :: A handle to the selected charmap. */ 02970 /* */ 02971 /* <Return> */ 02972 /* FreeType error code. 0~means success. */ 02973 /* */ 02974 /* <Note> */ 02975 /* This function returns an error if the charmap is not part of */ 02976 /* the face (i.e., if it is not listed in the `face->charmaps' */ 02977 /* table). */ 02978 /* */ 02979 /* It also fails if a type~14 charmap is selected. */ 02980 /* */ 02981 FT_EXPORT( FT_Error ) 02982 FT_Set_Charmap( FT_Face face, 02983 FT_CharMap charmap ); 02984 02985 02986 /************************************************************************* 02987 * 02988 * @function: 02989 * FT_Get_Charmap_Index 02990 * 02991 * @description: 02992 * Retrieve index of a given charmap. 02993 * 02994 * @input: 02995 * charmap :: 02996 * A handle to a charmap. 02997 * 02998 * @return: 02999 * The index into the array of character maps within the face to which 03000 * `charmap' belongs. 03001 * 03002 */ 03003 FT_EXPORT( FT_Int ) 03004 FT_Get_Charmap_Index( FT_CharMap charmap ); 03005 03006 03007 /*************************************************************************/ 03008 /* */ 03009 /* <Function> */ 03010 /* FT_Get_Char_Index */ 03011 /* */ 03012 /* <Description> */ 03013 /* Return the glyph index of a given character code. This function */ 03014 /* uses a charmap object to do the mapping. */ 03015 /* */ 03016 /* <Input> */ 03017 /* face :: A handle to the source face object. */ 03018 /* */ 03019 /* charcode :: The character code. */ 03020 /* */ 03021 /* <Return> */ 03022 /* The glyph index. 0~means `undefined character code'. */ 03023 /* */ 03024 /* <Note> */ 03025 /* If you use FreeType to manipulate the contents of font files */ 03026 /* directly, be aware that the glyph index returned by this function */ 03027 /* doesn't always correspond to the internal indices used within */ 03028 /* the file. This is done to ensure that value~0 always corresponds */ 03029 /* to the `missing glyph'. */ 03030 /* */ 03031 FT_EXPORT( FT_UInt ) 03032 FT_Get_Char_Index( FT_Face face, 03033 FT_ULong charcode ); 03034 03035 03036 /*************************************************************************/ 03037 /* */ 03038 /* <Function> */ 03039 /* FT_Get_First_Char */ 03040 /* */ 03041 /* <Description> */ 03042 /* This function is used to return the first character code in the */ 03043 /* current charmap of a given face. It also returns the */ 03044 /* corresponding glyph index. */ 03045 /* */ 03046 /* <Input> */ 03047 /* face :: A handle to the source face object. */ 03048 /* */ 03049 /* <Output> */ 03050 /* agindex :: Glyph index of first character code. 0~if charmap is */ 03051 /* empty. */ 03052 /* */ 03053 /* <Return> */ 03054 /* The charmap's first character code. */ 03055 /* */ 03056 /* <Note> */ 03057 /* You should use this function with @FT_Get_Next_Char to be able to */ 03058 /* parse all character codes available in a given charmap. The code */ 03059 /* should look like this: */ 03060 /* */ 03061 /* { */ 03062 /* FT_ULong charcode; */ 03063 /* FT_UInt gindex; */ 03064 /* */ 03065 /* */ 03066 /* charcode = FT_Get_First_Char( face, &gindex ); */ 03067 /* while ( gindex != 0 ) */ 03068 /* { */ 03069 /* ... do something with (charcode,gindex) pair ... */ 03070 /* */ 03071 /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ 03072 /* } */ 03073 /* } */ 03074 /* */ 03075 /* Note that `*agindex' is set to~0 if the charmap is empty. The */ 03076 /* result itself can be~0 in two cases: if the charmap is empty or */ 03077 /* if the value~0 is the first valid character code. */ 03078 /* */ 03079 FT_EXPORT( FT_ULong ) 03080 FT_Get_First_Char( FT_Face face, 03081 FT_UInt *agindex ); 03082 03083 03084 /*************************************************************************/ 03085 /* */ 03086 /* <Function> */ 03087 /* FT_Get_Next_Char */ 03088 /* */ 03089 /* <Description> */ 03090 /* This function is used to return the next character code in the */ 03091 /* current charmap of a given face following the value `char_code', */ 03092 /* as well as the corresponding glyph index. */ 03093 /* */ 03094 /* <Input> */ 03095 /* face :: A handle to the source face object. */ 03096 /* char_code :: The starting character code. */ 03097 /* */ 03098 /* <Output> */ 03099 /* agindex :: Glyph index of next character code. 0~if charmap */ 03100 /* is empty. */ 03101 /* */ 03102 /* <Return> */ 03103 /* The charmap's next character code. */ 03104 /* */ 03105 /* <Note> */ 03106 /* You should use this function with @FT_Get_First_Char to walk */ 03107 /* over all character codes available in a given charmap. See the */ 03108 /* note for this function for a simple code example. */ 03109 /* */ 03110 /* Note that `*agindex' is set to~0 when there are no more codes in */ 03111 /* the charmap. */ 03112 /* */ 03113 FT_EXPORT( FT_ULong ) 03114 FT_Get_Next_Char( FT_Face face, 03115 FT_ULong char_code, 03116 FT_UInt *agindex ); 03117 03118 03119 /*************************************************************************/ 03120 /* */ 03121 /* <Function> */ 03122 /* FT_Get_Name_Index */ 03123 /* */ 03124 /* <Description> */ 03125 /* Return the glyph index of a given glyph name. This function uses */ 03126 /* driver specific objects to do the translation. */ 03127 /* */ 03128 /* <Input> */ 03129 /* face :: A handle to the source face object. */ 03130 /* */ 03131 /* glyph_name :: The glyph name. */ 03132 /* */ 03133 /* <Return> */ 03134 /* The glyph index. 0~means `undefined character code'. */ 03135 /* */ 03136 FT_EXPORT( FT_UInt ) 03137 FT_Get_Name_Index( FT_Face face, 03138 FT_String* glyph_name ); 03139 03140 03141 /************************************************************************* 03142 * 03143 * @macro: 03144 * FT_SUBGLYPH_FLAG_XXX 03145 * 03146 * @description: 03147 * A list of constants used to describe subglyphs. Please refer to the 03148 * TrueType specification for the meaning of the various flags. 03149 * 03150 * @values: 03151 * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: 03152 * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: 03153 * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: 03154 * FT_SUBGLYPH_FLAG_SCALE :: 03155 * FT_SUBGLYPH_FLAG_XY_SCALE :: 03156 * FT_SUBGLYPH_FLAG_2X2 :: 03157 * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: 03158 * 03159 */ 03160 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 03161 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 03162 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 03163 #define FT_SUBGLYPH_FLAG_SCALE 8 03164 #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 03165 #define FT_SUBGLYPH_FLAG_2X2 0x80 03166 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 03167 03168 03169 /************************************************************************* 03170 * 03171 * @func: 03172 * FT_Get_SubGlyph_Info 03173 * 03174 * @description: 03175 * Retrieve a description of a given subglyph. Only use it if 03176 * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is 03177 * returned otherwise. 03178 * 03179 * @input: 03180 * glyph :: 03181 * The source glyph slot. 03182 * 03183 * sub_index :: 03184 * The index of the subglyph. Must be less than 03185 * `glyph->num_subglyphs'. 03186 * 03187 * @output: 03188 * p_index :: 03189 * The glyph index of the subglyph. 03190 * 03191 * p_flags :: 03192 * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. 03193 * 03194 * p_arg1 :: 03195 * The subglyph's first argument (if any). 03196 * 03197 * p_arg2 :: 03198 * The subglyph's second argument (if any). 03199 * 03200 * p_transform :: 03201 * The subglyph transformation (if any). 03202 * 03203 * @return: 03204 * FreeType error code. 0~means success. 03205 * 03206 * @note: 03207 * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be 03208 * interpreted depending on the flags returned in `*p_flags'. See the 03209 * TrueType specification for details. 03210 * 03211 */ 03212 FT_EXPORT( FT_Error ) 03213 FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, 03214 FT_UInt sub_index, 03215 FT_Int *p_index, 03216 FT_UInt *p_flags, 03217 FT_Int *p_arg1, 03218 FT_Int *p_arg2, 03219 FT_Matrix *p_transform ); 03220 03221 03222 /*************************************************************************/ 03223 /* */ 03224 /* <Enum> */ 03225 /* FT_FSTYPE_XXX */ 03226 /* */ 03227 /* <Description> */ 03228 /* A list of bit flags used in the `fsType' field of the OS/2 table */ 03229 /* in a TrueType or OpenType font and the `FSType' entry in a */ 03230 /* PostScript font. These bit flags are returned by */ 03231 /* @FT_Get_FSType_Flags; they inform client applications of embedding */ 03232 /* and subsetting restrictions associated with a font. */ 03233 /* */ 03234 /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ 03235 /* more details. */ 03236 /* */ 03237 /* <Values> */ 03238 /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ 03239 /* Fonts with no fsType bit set may be embedded and permanently */ 03240 /* installed on the remote system by an application. */ 03241 /* */ 03242 /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ 03243 /* Fonts that have only this bit set must not be modified, embedded */ 03244 /* or exchanged in any manner without first obtaining permission of */ 03245 /* the font software copyright owner. */ 03246 /* */ 03247 /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ 03248 /* If this bit is set, the font may be embedded and temporarily */ 03249 /* loaded on the remote system. Documents containing Preview & */ 03250 /* Print fonts must be opened `read-only'; no edits can be applied */ 03251 /* to the document. */ 03252 /* */ 03253 /* FT_FSTYPE_EDITABLE_EMBEDDING :: */ 03254 /* If this bit is set, the font may be embedded but must only be */ 03255 /* installed temporarily on other systems. In contrast to Preview */ 03256 /* & Print fonts, documents containing editable fonts may be opened */ 03257 /* for reading, editing is permitted, and changes may be saved. */ 03258 /* */ 03259 /* FT_FSTYPE_NO_SUBSETTING :: */ 03260 /* If this bit is set, the font may not be subsetted prior to */ 03261 /* embedding. */ 03262 /* */ 03263 /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ 03264 /* If this bit is set, only bitmaps contained in the font may be */ 03265 /* embedded; no outline data may be embedded. If there are no */ 03266 /* bitmaps available in the font, then the font is unembeddable. */ 03267 /* */ 03268 /* <Note> */ 03269 /* While the fsType flags can indicate that a font may be embedded, a */ 03270 /* license with the font vendor may be separately required to use the */ 03271 /* font in this way. */ 03272 /* */ 03273 #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 03274 #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 03275 #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 03276 #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 03277 #define FT_FSTYPE_NO_SUBSETTING 0x0100 03278 #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 03279 03280 03281 /*************************************************************************/ 03282 /* */ 03283 /* <Function> */ 03284 /* FT_Get_FSType_Flags */ 03285 /* */ 03286 /* <Description> */ 03287 /* Return the fsType flags for a font. */ 03288 /* */ 03289 /* <Input> */ 03290 /* face :: A handle to the source face object. */ 03291 /* */ 03292 /* <Return> */ 03293 /* The fsType flags, @FT_FSTYPE_XXX. */ 03294 /* */ 03295 /* <Note> */ 03296 /* Use this function rather than directly reading the `fs_type' field */ 03297 /* in the @PS_FontInfoRec structure which is only guaranteed to */ 03298 /* return the correct results for Type~1 fonts. */ 03299 /* */ 03300 FT_EXPORT( FT_UShort ) 03301 FT_Get_FSType_Flags( FT_Face face ); 03302 03303 03304 /*************************************************************************/ 03305 /* */ 03306 /* <Section> */ 03307 /* glyph_variants */ 03308 /* */ 03309 /* <Title> */ 03310 /* Glyph Variants */ 03311 /* */ 03312 /* <Abstract> */ 03313 /* The FreeType~2 interface to Unicode Ideographic Variation */ 03314 /* Sequences (IVS), using the SFNT cmap format~14. */ 03315 /* */ 03316 /* <Description> */ 03317 /* Many CJK characters have variant forms. They are a sort of grey */ 03318 /* area somewhere between being totally irrelevant and semantically */ 03319 /* distinct; for this reason, the Unicode consortium decided to */ 03320 /* introduce Ideographic Variation Sequences (IVS), consisting of a */ 03321 /* Unicode base character and one of 240 variant selectors */ 03322 /* (U+E0100-U+E01EF), instead of further extending the already huge */ 03323 /* code range for CJK characters. */ 03324 /* */ 03325 /* An IVS is registered and unique; for further details please refer */ 03326 /* to Unicode Technical Report #37, the Ideographic Variation */ 03327 /* Database. To date (October 2007), the character with the most */ 03328 /* variants is U+908A, having 8~such IVS. */ 03329 /* */ 03330 /* Adobe and MS decided to support IVS with a new cmap subtable */ 03331 /* (format~14). It is an odd subtable because it is not a mapping of */ 03332 /* input code points to glyphs, but contains lists of all variants */ 03333 /* supported by the font. */ 03334 /* */ 03335 /* A variant may be either `default' or `non-default'. A default */ 03336 /* variant is the one you will get for that code point if you look it */ 03337 /* up in the standard Unicode cmap. A non-default variant is a */ 03338 /* different glyph. */ 03339 /* */ 03340 /*************************************************************************/ 03341 03342 03343 /*************************************************************************/ 03344 /* */ 03345 /* <Function> */ 03346 /* FT_Face_GetCharVariantIndex */ 03347 /* */ 03348 /* <Description> */ 03349 /* Return the glyph index of a given character code as modified by */ 03350 /* the variation selector. */ 03351 /* */ 03352 /* <Input> */ 03353 /* face :: */ 03354 /* A handle to the source face object. */ 03355 /* */ 03356 /* charcode :: */ 03357 /* The character code point in Unicode. */ 03358 /* */ 03359 /* variantSelector :: */ 03360 /* The Unicode code point of the variation selector. */ 03361 /* */ 03362 /* <Return> */ 03363 /* The glyph index. 0~means either `undefined character code', or */ 03364 /* `undefined selector code', or `no variation selector cmap */ 03365 /* subtable', or `current CharMap is not Unicode'. */ 03366 /* */ 03367 /* <Note> */ 03368 /* If you use FreeType to manipulate the contents of font files */ 03369 /* directly, be aware that the glyph index returned by this function */ 03370 /* doesn't always correspond to the internal indices used within */ 03371 /* the file. This is done to ensure that value~0 always corresponds */ 03372 /* to the `missing glyph'. */ 03373 /* */ 03374 /* This function is only meaningful if */ 03375 /* a) the font has a variation selector cmap sub table, */ 03376 /* and */ 03377 /* b) the current charmap has a Unicode encoding. */ 03378 /* */ 03379 /* <Since> */ 03380 /* 2.3.6 */ 03381 /* */ 03382 FT_EXPORT( FT_UInt ) 03383 FT_Face_GetCharVariantIndex( FT_Face face, 03384 FT_ULong charcode, 03385 FT_ULong variantSelector ); 03386 03387 03388 /*************************************************************************/ 03389 /* */ 03390 /* <Function> */ 03391 /* FT_Face_GetCharVariantIsDefault */ 03392 /* */ 03393 /* <Description> */ 03394 /* Check whether this variant of this Unicode character is the one to */ 03395 /* be found in the `cmap'. */ 03396 /* */ 03397 /* <Input> */ 03398 /* face :: */ 03399 /* A handle to the source face object. */ 03400 /* */ 03401 /* charcode :: */ 03402 /* The character codepoint in Unicode. */ 03403 /* */ 03404 /* variantSelector :: */ 03405 /* The Unicode codepoint of the variation selector. */ 03406 /* */ 03407 /* <Return> */ 03408 /* 1~if found in the standard (Unicode) cmap, 0~if found in the */ 03409 /* variation selector cmap, or -1 if it is not a variant. */ 03410 /* */ 03411 /* <Note> */ 03412 /* This function is only meaningful if the font has a variation */ 03413 /* selector cmap subtable. */ 03414 /* */ 03415 /* <Since> */ 03416 /* 2.3.6 */ 03417 /* */ 03418 FT_EXPORT( FT_Int ) 03419 FT_Face_GetCharVariantIsDefault( FT_Face face, 03420 FT_ULong charcode, 03421 FT_ULong variantSelector ); 03422 03423 03424 /*************************************************************************/ 03425 /* */ 03426 /* <Function> */ 03427 /* FT_Face_GetVariantSelectors */ 03428 /* */ 03429 /* <Description> */ 03430 /* Return a zero-terminated list of Unicode variant selectors found */ 03431 /* in the font. */ 03432 /* */ 03433 /* <Input> */ 03434 /* face :: */ 03435 /* A handle to the source face object. */ 03436 /* */ 03437 /* <Return> */ 03438 /* A pointer to an array of selector code points, or NULL if there is */ 03439 /* no valid variant selector cmap subtable. */ 03440 /* */ 03441 /* <Note> */ 03442 /* The last item in the array is~0; the array is owned by the */ 03443 /* @FT_Face object but can be overwritten or released on the next */ 03444 /* call to a FreeType function. */ 03445 /* */ 03446 /* <Since> */ 03447 /* 2.3.6 */ 03448 /* */ 03449 FT_EXPORT( FT_UInt32* ) 03450 FT_Face_GetVariantSelectors( FT_Face face ); 03451 03452 03453 /*************************************************************************/ 03454 /* */ 03455 /* <Function> */ 03456 /* FT_Face_GetVariantsOfChar */ 03457 /* */ 03458 /* <Description> */ 03459 /* Return a zero-terminated list of Unicode variant selectors found */ 03460 /* for the specified character code. */ 03461 /* */ 03462 /* <Input> */ 03463 /* face :: */ 03464 /* A handle to the source face object. */ 03465 /* */ 03466 /* charcode :: */ 03467 /* The character codepoint in Unicode. */ 03468 /* */ 03469 /* <Return> */ 03470 /* A pointer to an array of variant selector code points which are */ 03471 /* active for the given character, or NULL if the corresponding list */ 03472 /* is empty. */ 03473 /* */ 03474 /* <Note> */ 03475 /* The last item in the array is~0; the array is owned by the */ 03476 /* @FT_Face object but can be overwritten or released on the next */ 03477 /* call to a FreeType function. */ 03478 /* */ 03479 /* <Since> */ 03480 /* 2.3.6 */ 03481 /* */ 03482 FT_EXPORT( FT_UInt32* ) 03483 FT_Face_GetVariantsOfChar( FT_Face face, 03484 FT_ULong charcode ); 03485 03486 03487 /*************************************************************************/ 03488 /* */ 03489 /* <Function> */ 03490 /* FT_Face_GetCharsOfVariant */ 03491 /* */ 03492 /* <Description> */ 03493 /* Return a zero-terminated list of Unicode character codes found for */ 03494 /* the specified variant selector. */ 03495 /* */ 03496 /* <Input> */ 03497 /* face :: */ 03498 /* A handle to the source face object. */ 03499 /* */ 03500 /* variantSelector :: */ 03501 /* The variant selector code point in Unicode. */ 03502 /* */ 03503 /* <Return> */ 03504 /* A list of all the code points which are specified by this selector */ 03505 /* (both default and non-default codes are returned) or NULL if there */ 03506 /* is no valid cmap or the variant selector is invalid. */ 03507 /* */ 03508 /* <Note> */ 03509 /* The last item in the array is~0; the array is owned by the */ 03510 /* @FT_Face object but can be overwritten or released on the next */ 03511 /* call to a FreeType function. */ 03512 /* */ 03513 /* <Since> */ 03514 /* 2.3.6 */ 03515 /* */ 03516 FT_EXPORT( FT_UInt32* ) 03517 FT_Face_GetCharsOfVariant( FT_Face face, 03518 FT_ULong variantSelector ); 03519 03520 03521 /*************************************************************************/ 03522 /* */ 03523 /* <Section> */ 03524 /* computations */ 03525 /* */ 03526 /* <Title> */ 03527 /* Computations */ 03528 /* */ 03529 /* <Abstract> */ 03530 /* Crunching fixed numbers and vectors. */ 03531 /* */ 03532 /* <Description> */ 03533 /* This section contains various functions used to perform */ 03534 /* computations on 16.16 fixed-float numbers or 2d vectors. */ 03535 /* */ 03536 /* <Order> */ 03537 /* FT_MulDiv */ 03538 /* FT_MulFix */ 03539 /* FT_DivFix */ 03540 /* FT_RoundFix */ 03541 /* FT_CeilFix */ 03542 /* FT_FloorFix */ 03543 /* FT_Vector_Transform */ 03544 /* FT_Matrix_Multiply */ 03545 /* FT_Matrix_Invert */ 03546 /* */ 03547 /*************************************************************************/ 03548 03549 03550 /*************************************************************************/ 03551 /* */ 03552 /* <Function> */ 03553 /* FT_MulDiv */ 03554 /* */ 03555 /* <Description> */ 03556 /* A very simple function used to perform the computation `(a*b)/c' */ 03557 /* with maximal accuracy (it uses a 64-bit intermediate integer */ 03558 /* whenever necessary). */ 03559 /* */ 03560 /* This function isn't necessarily as fast as some processor specific */ 03561 /* operations, but is at least completely portable. */ 03562 /* */ 03563 /* <Input> */ 03564 /* a :: The first multiplier. */ 03565 /* b :: The second multiplier. */ 03566 /* c :: The divisor. */ 03567 /* */ 03568 /* <Return> */ 03569 /* The result of `(a*b)/c'. This function never traps when trying to */ 03570 /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ 03571 /* on the signs of `a' and `b'. */ 03572 /* */ 03573 FT_EXPORT( FT_Long ) 03574 FT_MulDiv( FT_Long a, 03575 FT_Long b, 03576 FT_Long c ); 03577 03578 03579 /* */ 03580 03581 /* The following #if 0 ... #endif is for the documentation formatter, */ 03582 /* hiding the internal `FT_MULFIX_INLINED' macro. */ 03583 03584 #if 0 03585 /*************************************************************************/ 03586 /* */ 03587 /* <Function> */ 03588 /* FT_MulFix */ 03589 /* */ 03590 /* <Description> */ 03591 /* A very simple function used to perform the computation */ 03592 /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */ 03593 /* used to multiply a given value by a 16.16 fixed float factor. */ 03594 /* */ 03595 /* <Input> */ 03596 /* a :: The first multiplier. */ 03597 /* b :: The second multiplier. Use a 16.16 factor here whenever */ 03598 /* possible (see note below). */ 03599 /* */ 03600 /* <Return> */ 03601 /* The result of `(a*b)/0x10000'. */ 03602 /* */ 03603 /* <Note> */ 03604 /* This function has been optimized for the case where the absolute */ 03605 /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ 03606 /* As this happens mainly when scaling from notional units to */ 03607 /* fractional pixels in FreeType, it resulted in noticeable speed */ 03608 /* improvements between versions 2.x and 1.x. */ 03609 /* */ 03610 /* As a conclusion, always try to place a 16.16 factor as the */ 03611 /* _second_ argument of this function; this can make a great */ 03612 /* difference. */ 03613 /* */ 03614 FT_EXPORT( FT_Long ) 03615 FT_MulFix( FT_Long a, 03616 FT_Long b ); 03617 03618 /* */ 03619 #endif 03620 03621 #ifdef FT_MULFIX_INLINED 03622 #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b ) 03623 #else 03624 FT_EXPORT( FT_Long ) 03625 FT_MulFix( FT_Long a, 03626 FT_Long b ); 03627 #endif 03628 03629 03630 /*************************************************************************/ 03631 /* */ 03632 /* <Function> */ 03633 /* FT_DivFix */ 03634 /* */ 03635 /* <Description> */ 03636 /* A very simple function used to perform the computation */ 03637 /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */ 03638 /* used to divide a given value by a 16.16 fixed float factor. */ 03639 /* */ 03640 /* <Input> */ 03641 /* a :: The first multiplier. */ 03642 /* b :: The second multiplier. Use a 16.16 factor here whenever */ 03643 /* possible (see note below). */ 03644 /* */ 03645 /* <Return> */ 03646 /* The result of `(a*0x10000)/b'. */ 03647 /* */ 03648 /* <Note> */ 03649 /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */ 03650 /* 32~bits, then the division is computed directly. Otherwise, we */ 03651 /* use a specialized version of @FT_MulDiv. */ 03652 /* */ 03653 FT_EXPORT( FT_Long ) 03654 FT_DivFix( FT_Long a, 03655 FT_Long b ); 03656 03657 03658 /*************************************************************************/ 03659 /* */ 03660 /* <Function> */ 03661 /* FT_RoundFix */ 03662 /* */ 03663 /* <Description> */ 03664 /* A very simple function used to round a 16.16 fixed number. */ 03665 /* */ 03666 /* <Input> */ 03667 /* a :: The number to be rounded. */ 03668 /* */ 03669 /* <Return> */ 03670 /* The result of `(a + 0x8000) & -0x10000'. */ 03671 /* */ 03672 FT_EXPORT( FT_Fixed ) 03673 FT_RoundFix( FT_Fixed a ); 03674 03675 03676 /*************************************************************************/ 03677 /* */ 03678 /* <Function> */ 03679 /* FT_CeilFix */ 03680 /* */ 03681 /* <Description> */ 03682 /* A very simple function used to compute the ceiling function of a */ 03683 /* 16.16 fixed number. */ 03684 /* */ 03685 /* <Input> */ 03686 /* a :: The number for which the ceiling function is to be computed. */ 03687 /* */ 03688 /* <Return> */ 03689 /* The result of `(a + 0x10000 - 1) & -0x10000'. */ 03690 /* */ 03691 FT_EXPORT( FT_Fixed ) 03692 FT_CeilFix( FT_Fixed a ); 03693 03694 03695 /*************************************************************************/ 03696 /* */ 03697 /* <Function> */ 03698 /* FT_FloorFix */ 03699 /* */ 03700 /* <Description> */ 03701 /* A very simple function used to compute the floor function of a */ 03702 /* 16.16 fixed number. */ 03703 /* */ 03704 /* <Input> */ 03705 /* a :: The number for which the floor function is to be computed. */ 03706 /* */ 03707 /* <Return> */ 03708 /* The result of `a & -0x10000'. */ 03709 /* */ 03710 FT_EXPORT( FT_Fixed ) 03711 FT_FloorFix( FT_Fixed a ); 03712 03713 03714 /*************************************************************************/ 03715 /* */ 03716 /* <Function> */ 03717 /* FT_Vector_Transform */ 03718 /* */ 03719 /* <Description> */ 03720 /* Transform a single vector through a 2x2 matrix. */ 03721 /* */ 03722 /* <InOut> */ 03723 /* vector :: The target vector to transform. */ 03724 /* */ 03725 /* <Input> */ 03726 /* matrix :: A pointer to the source 2x2 matrix. */ 03727 /* */ 03728 /* <Note> */ 03729 /* The result is undefined if either `vector' or `matrix' is invalid. */ 03730 /* */ 03731 FT_EXPORT( void ) 03732 FT_Vector_Transform( FT_Vector* vec, 03733 const FT_Matrix* matrix ); 03734 03735 03736 /*************************************************************************/ 03737 /* */ 03738 /* <Section> */ 03739 /* version */ 03740 /* */ 03741 /* <Title> */ 03742 /* FreeType Version */ 03743 /* */ 03744 /* <Abstract> */ 03745 /* Functions and macros related to FreeType versions. */ 03746 /* */ 03747 /* <Description> */ 03748 /* Note that those functions and macros are of limited use because */ 03749 /* even a new release of FreeType with only documentation changes */ 03750 /* increases the version number. */ 03751 /* */ 03752 /*************************************************************************/ 03753 03754 03755 /************************************************************************* 03756 * 03757 * @enum: 03758 * FREETYPE_XXX 03759 * 03760 * @description: 03761 * These three macros identify the FreeType source code version. 03762 * Use @FT_Library_Version to access them at runtime. 03763 * 03764 * @values: 03765 * FREETYPE_MAJOR :: The major version number. 03766 * FREETYPE_MINOR :: The minor version number. 03767 * FREETYPE_PATCH :: The patch level. 03768 * 03769 * @note: 03770 * The version number of FreeType if built as a dynamic link library 03771 * with the `libtool' package is _not_ controlled by these three 03772 * macros. 03773 * 03774 */ 03775 #define FREETYPE_MAJOR 2 03776 #define FREETYPE_MINOR 3 03777 #define FREETYPE_PATCH 12 03778 03779 03780 /*************************************************************************/ 03781 /* */ 03782 /* <Function> */ 03783 /* FT_Library_Version */ 03784 /* */ 03785 /* <Description> */ 03786 /* Return the version of the FreeType library being used. This is */ 03787 /* useful when dynamically linking to the library, since one cannot */ 03788 /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ 03789 /* @FREETYPE_PATCH. */ 03790 /* */ 03791 /* <Input> */ 03792 /* library :: A source library handle. */ 03793 /* */ 03794 /* <Output> */ 03795 /* amajor :: The major version number. */ 03796 /* */ 03797 /* aminor :: The minor version number. */ 03798 /* */ 03799 /* apatch :: The patch version number. */ 03800 /* */ 03801 /* <Note> */ 03802 /* The reason why this function takes a `library' argument is because */ 03803 /* certain programs implement library initialization in a custom way */ 03804 /* that doesn't use @FT_Init_FreeType. */ 03805 /* */ 03806 /* In such cases, the library version might not be available before */ 03807 /* the library object has been created. */ 03808 /* */ 03809 FT_EXPORT( void ) 03810 FT_Library_Version( FT_Library library, 03811 FT_Int *amajor, 03812 FT_Int *aminor, 03813 FT_Int *apatch ); 03814 03815 03816 /*************************************************************************/ 03817 /* */ 03818 /* <Function> */ 03819 /* FT_Face_CheckTrueTypePatents */ 03820 /* */ 03821 /* <Description> */ 03822 /* Parse all bytecode instructions of a TrueType font file to check */ 03823 /* whether any of the patented opcodes are used. This is only useful */ 03824 /* if you want to be able to use the unpatented hinter with */ 03825 /* fonts that do *not* use these opcodes. */ 03826 /* */ 03827 /* Note that this function parses *all* glyph instructions in the */ 03828 /* font file, which may be slow. */ 03829 /* */ 03830 /* <Input> */ 03831 /* face :: A face handle. */ 03832 /* */ 03833 /* <Return> */ 03834 /* 1~if this is a TrueType font that uses one of the patented */ 03835 /* opcodes, 0~otherwise. */ 03836 /* */ 03837 /* <Since> */ 03838 /* 2.3.5 */ 03839 /* */ 03840 FT_EXPORT( FT_Bool ) 03841 FT_Face_CheckTrueTypePatents( FT_Face face ); 03842 03843 03844 /*************************************************************************/ 03845 /* */ 03846 /* <Function> */ 03847 /* FT_Face_SetUnpatentedHinting */ 03848 /* */ 03849 /* <Description> */ 03850 /* Enable or disable the unpatented hinter for a given face. */ 03851 /* Only enable it if you have determined that the face doesn't */ 03852 /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */ 03853 /* */ 03854 /* <Input> */ 03855 /* face :: A face handle. */ 03856 /* */ 03857 /* value :: New boolean setting. */ 03858 /* */ 03859 /* <Return> */ 03860 /* The old setting value. This will always be false if this is not */ 03861 /* an SFNT font, or if the unpatented hinter is not compiled in this */ 03862 /* instance of the library. */ 03863 /* */ 03864 /* <Since> */ 03865 /* 2.3.5 */ 03866 /* */ 03867 FT_EXPORT( FT_Bool ) 03868 FT_Face_SetUnpatentedHinting( FT_Face face, 03869 FT_Bool value ); 03870 03871 /* */ 03872 03873 03874 FT_END_HEADER 03875 03876 #endif /* __FREETYPE_H__ */ 03877 03878 03879 /* END */