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