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