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