vrshoot

annotate libs/ft2static/freetype/ftglyph.h @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +0200
parents
children
rev   line source
nuclear@0 1 /***************************************************************************/
nuclear@0 2 /* */
nuclear@0 3 /* ftglyph.h */
nuclear@0 4 /* */
nuclear@0 5 /* FreeType convenience functions to handle glyphs (specification). */
nuclear@0 6 /* */
nuclear@0 7 /* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */
nuclear@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
nuclear@0 9 /* */
nuclear@0 10 /* This file is part of the FreeType project, and may only be used, */
nuclear@0 11 /* modified, and distributed under the terms of the FreeType project */
nuclear@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
nuclear@0 13 /* this file you indicate that you have read the license and */
nuclear@0 14 /* understand and accept it fully. */
nuclear@0 15 /* */
nuclear@0 16 /***************************************************************************/
nuclear@0 17
nuclear@0 18
nuclear@0 19 /*************************************************************************/
nuclear@0 20 /* */
nuclear@0 21 /* This file contains the definition of several convenience functions */
nuclear@0 22 /* that can be used by client applications to easily retrieve glyph */
nuclear@0 23 /* bitmaps and outlines from a given face. */
nuclear@0 24 /* */
nuclear@0 25 /* These functions should be optional if you are writing a font server */
nuclear@0 26 /* or text layout engine on top of FreeType. However, they are pretty */
nuclear@0 27 /* handy for many other simple uses of the library. */
nuclear@0 28 /* */
nuclear@0 29 /*************************************************************************/
nuclear@0 30
nuclear@0 31
nuclear@0 32 #ifndef __FTGLYPH_H__
nuclear@0 33 #define __FTGLYPH_H__
nuclear@0 34
nuclear@0 35
nuclear@0 36 #include <ft2build.h>
nuclear@0 37 #include FT_FREETYPE_H
nuclear@0 38
nuclear@0 39 #ifdef FREETYPE_H
nuclear@0 40 #error "freetype.h of FreeType 1 has been loaded!"
nuclear@0 41 #error "Please fix the directory search order for header files"
nuclear@0 42 #error "so that freetype.h of FreeType 2 is found first."
nuclear@0 43 #endif
nuclear@0 44
nuclear@0 45
nuclear@0 46 FT_BEGIN_HEADER
nuclear@0 47
nuclear@0 48
nuclear@0 49 /*************************************************************************/
nuclear@0 50 /* */
nuclear@0 51 /* <Section> */
nuclear@0 52 /* glyph_management */
nuclear@0 53 /* */
nuclear@0 54 /* <Title> */
nuclear@0 55 /* Glyph Management */
nuclear@0 56 /* */
nuclear@0 57 /* <Abstract> */
nuclear@0 58 /* Generic interface to manage individual glyph data. */
nuclear@0 59 /* */
nuclear@0 60 /* <Description> */
nuclear@0 61 /* This section contains definitions used to manage glyph data */
nuclear@0 62 /* through generic FT_Glyph objects. Each of them can contain a */
nuclear@0 63 /* bitmap, a vector outline, or even images in other formats. */
nuclear@0 64 /* */
nuclear@0 65 /*************************************************************************/
nuclear@0 66
nuclear@0 67
nuclear@0 68 /* forward declaration to a private type */
nuclear@0 69 typedef struct FT_Glyph_Class_ FT_Glyph_Class;
nuclear@0 70
nuclear@0 71
nuclear@0 72 /*************************************************************************/
nuclear@0 73 /* */
nuclear@0 74 /* <Type> */
nuclear@0 75 /* FT_Glyph */
nuclear@0 76 /* */
nuclear@0 77 /* <Description> */
nuclear@0 78 /* Handle to an object used to model generic glyph images. It is a */
nuclear@0 79 /* pointer to the @FT_GlyphRec structure and can contain a glyph */
nuclear@0 80 /* bitmap or pointer. */
nuclear@0 81 /* */
nuclear@0 82 /* <Note> */
nuclear@0 83 /* Glyph objects are not owned by the library. You must thus release */
nuclear@0 84 /* them manually (through @FT_Done_Glyph) _before_ calling */
nuclear@0 85 /* @FT_Done_FreeType. */
nuclear@0 86 /* */
nuclear@0 87 typedef struct FT_GlyphRec_* FT_Glyph;
nuclear@0 88
nuclear@0 89
nuclear@0 90 /*************************************************************************/
nuclear@0 91 /* */
nuclear@0 92 /* <Struct> */
nuclear@0 93 /* FT_GlyphRec */
nuclear@0 94 /* */
nuclear@0 95 /* <Description> */
nuclear@0 96 /* The root glyph structure contains a given glyph image plus its */
nuclear@0 97 /* advance width in 16.16 fixed float format. */
nuclear@0 98 /* */
nuclear@0 99 /* <Fields> */
nuclear@0 100 /* library :: A handle to the FreeType library object. */
nuclear@0 101 /* */
nuclear@0 102 /* clazz :: A pointer to the glyph's class. Private. */
nuclear@0 103 /* */
nuclear@0 104 /* format :: The format of the glyph's image. */
nuclear@0 105 /* */
nuclear@0 106 /* advance :: A 16.16 vector that gives the glyph's advance width. */
nuclear@0 107 /* */
nuclear@0 108 typedef struct FT_GlyphRec_
nuclear@0 109 {
nuclear@0 110 FT_Library library;
nuclear@0 111 const FT_Glyph_Class* clazz;
nuclear@0 112 FT_Glyph_Format format;
nuclear@0 113 FT_Vector advance;
nuclear@0 114
nuclear@0 115 } FT_GlyphRec;
nuclear@0 116
nuclear@0 117
nuclear@0 118 /*************************************************************************/
nuclear@0 119 /* */
nuclear@0 120 /* <Type> */
nuclear@0 121 /* FT_BitmapGlyph */
nuclear@0 122 /* */
nuclear@0 123 /* <Description> */
nuclear@0 124 /* A handle to an object used to model a bitmap glyph image. This is */
nuclear@0 125 /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */
nuclear@0 126 /* */
nuclear@0 127 typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
nuclear@0 128
nuclear@0 129
nuclear@0 130 /*************************************************************************/
nuclear@0 131 /* */
nuclear@0 132 /* <Struct> */
nuclear@0 133 /* FT_BitmapGlyphRec */
nuclear@0 134 /* */
nuclear@0 135 /* <Description> */
nuclear@0 136 /* A structure used for bitmap glyph images. This really is a */
nuclear@0 137 /* `sub-class' of @FT_GlyphRec. */
nuclear@0 138 /* */
nuclear@0 139 /* <Fields> */
nuclear@0 140 /* root :: The root @FT_Glyph fields. */
nuclear@0 141 /* */
nuclear@0 142 /* left :: The left-side bearing, i.e., the horizontal distance */
nuclear@0 143 /* from the current pen position to the left border of the */
nuclear@0 144 /* glyph bitmap. */
nuclear@0 145 /* */
nuclear@0 146 /* top :: The top-side bearing, i.e., the vertical distance from */
nuclear@0 147 /* the current pen position to the top border of the glyph */
nuclear@0 148 /* bitmap. This distance is positive for upwards~y! */
nuclear@0 149 /* */
nuclear@0 150 /* bitmap :: A descriptor for the bitmap. */
nuclear@0 151 /* */
nuclear@0 152 /* <Note> */
nuclear@0 153 /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */
nuclear@0 154 /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */
nuclear@0 155 /* the bitmap's contents easily. */
nuclear@0 156 /* */
nuclear@0 157 /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */
nuclear@0 158 /* and is thus created and destroyed with it. */
nuclear@0 159 /* */
nuclear@0 160 typedef struct FT_BitmapGlyphRec_
nuclear@0 161 {
nuclear@0 162 FT_GlyphRec root;
nuclear@0 163 FT_Int left;
nuclear@0 164 FT_Int top;
nuclear@0 165 FT_Bitmap bitmap;
nuclear@0 166
nuclear@0 167 } FT_BitmapGlyphRec;
nuclear@0 168
nuclear@0 169
nuclear@0 170 /*************************************************************************/
nuclear@0 171 /* */
nuclear@0 172 /* <Type> */
nuclear@0 173 /* FT_OutlineGlyph */
nuclear@0 174 /* */
nuclear@0 175 /* <Description> */
nuclear@0 176 /* A handle to an object used to model an outline glyph image. This */
nuclear@0 177 /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */
nuclear@0 178 /* */
nuclear@0 179 typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
nuclear@0 180
nuclear@0 181
nuclear@0 182 /*************************************************************************/
nuclear@0 183 /* */
nuclear@0 184 /* <Struct> */
nuclear@0 185 /* FT_OutlineGlyphRec */
nuclear@0 186 /* */
nuclear@0 187 /* <Description> */
nuclear@0 188 /* A structure used for outline (vectorial) glyph images. This */
nuclear@0 189 /* really is a `sub-class' of @FT_GlyphRec. */
nuclear@0 190 /* */
nuclear@0 191 /* <Fields> */
nuclear@0 192 /* root :: The root @FT_Glyph fields. */
nuclear@0 193 /* */
nuclear@0 194 /* outline :: A descriptor for the outline. */
nuclear@0 195 /* */
nuclear@0 196 /* <Note> */
nuclear@0 197 /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */
nuclear@0 198 /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */
nuclear@0 199 /* the outline's content easily. */
nuclear@0 200 /* */
nuclear@0 201 /* As the outline is extracted from a glyph slot, its coordinates are */
nuclear@0 202 /* expressed normally in 26.6 pixels, unless the flag */
nuclear@0 203 /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */
nuclear@0 204 /* */
nuclear@0 205 /* The outline's tables are always owned by the object and are */
nuclear@0 206 /* destroyed with it. */
nuclear@0 207 /* */
nuclear@0 208 typedef struct FT_OutlineGlyphRec_
nuclear@0 209 {
nuclear@0 210 FT_GlyphRec root;
nuclear@0 211 FT_Outline outline;
nuclear@0 212
nuclear@0 213 } FT_OutlineGlyphRec;
nuclear@0 214
nuclear@0 215
nuclear@0 216 /*************************************************************************/
nuclear@0 217 /* */
nuclear@0 218 /* <Function> */
nuclear@0 219 /* FT_Get_Glyph */
nuclear@0 220 /* */
nuclear@0 221 /* <Description> */
nuclear@0 222 /* A function used to extract a glyph image from a slot. Note that */
nuclear@0 223 /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */
nuclear@0 224 /* */
nuclear@0 225 /* <Input> */
nuclear@0 226 /* slot :: A handle to the source glyph slot. */
nuclear@0 227 /* */
nuclear@0 228 /* <Output> */
nuclear@0 229 /* aglyph :: A handle to the glyph object. */
nuclear@0 230 /* */
nuclear@0 231 /* <Return> */
nuclear@0 232 /* FreeType error code. 0~means success. */
nuclear@0 233 /* */
nuclear@0 234 FT_EXPORT( FT_Error )
nuclear@0 235 FT_Get_Glyph( FT_GlyphSlot slot,
nuclear@0 236 FT_Glyph *aglyph );
nuclear@0 237
nuclear@0 238
nuclear@0 239 /*************************************************************************/
nuclear@0 240 /* */
nuclear@0 241 /* <Function> */
nuclear@0 242 /* FT_Glyph_Copy */
nuclear@0 243 /* */
nuclear@0 244 /* <Description> */
nuclear@0 245 /* A function used to copy a glyph image. Note that the created */
nuclear@0 246 /* @FT_Glyph object must be released with @FT_Done_Glyph. */
nuclear@0 247 /* */
nuclear@0 248 /* <Input> */
nuclear@0 249 /* source :: A handle to the source glyph object. */
nuclear@0 250 /* */
nuclear@0 251 /* <Output> */
nuclear@0 252 /* target :: A handle to the target glyph object. 0~in case of */
nuclear@0 253 /* error. */
nuclear@0 254 /* */
nuclear@0 255 /* <Return> */
nuclear@0 256 /* FreeType error code. 0~means success. */
nuclear@0 257 /* */
nuclear@0 258 FT_EXPORT( FT_Error )
nuclear@0 259 FT_Glyph_Copy( FT_Glyph source,
nuclear@0 260 FT_Glyph *target );
nuclear@0 261
nuclear@0 262
nuclear@0 263 /*************************************************************************/
nuclear@0 264 /* */
nuclear@0 265 /* <Function> */
nuclear@0 266 /* FT_Glyph_Transform */
nuclear@0 267 /* */
nuclear@0 268 /* <Description> */
nuclear@0 269 /* Transform a glyph image if its format is scalable. */
nuclear@0 270 /* */
nuclear@0 271 /* <InOut> */
nuclear@0 272 /* glyph :: A handle to the target glyph object. */
nuclear@0 273 /* */
nuclear@0 274 /* <Input> */
nuclear@0 275 /* matrix :: A pointer to a 2x2 matrix to apply. */
nuclear@0 276 /* */
nuclear@0 277 /* delta :: A pointer to a 2d vector to apply. Coordinates are */
nuclear@0 278 /* expressed in 1/64th of a pixel. */
nuclear@0 279 /* */
nuclear@0 280 /* <Return> */
nuclear@0 281 /* FreeType error code (if not 0, the glyph format is not scalable). */
nuclear@0 282 /* */
nuclear@0 283 /* <Note> */
nuclear@0 284 /* The 2x2 transformation matrix is also applied to the glyph's */
nuclear@0 285 /* advance vector. */
nuclear@0 286 /* */
nuclear@0 287 FT_EXPORT( FT_Error )
nuclear@0 288 FT_Glyph_Transform( FT_Glyph glyph,
nuclear@0 289 FT_Matrix* matrix,
nuclear@0 290 FT_Vector* delta );
nuclear@0 291
nuclear@0 292
nuclear@0 293 /*************************************************************************/
nuclear@0 294 /* */
nuclear@0 295 /* <Enum> */
nuclear@0 296 /* FT_Glyph_BBox_Mode */
nuclear@0 297 /* */
nuclear@0 298 /* <Description> */
nuclear@0 299 /* The mode how the values of @FT_Glyph_Get_CBox are returned. */
nuclear@0 300 /* */
nuclear@0 301 /* <Values> */
nuclear@0 302 /* FT_GLYPH_BBOX_UNSCALED :: */
nuclear@0 303 /* Return unscaled font units. */
nuclear@0 304 /* */
nuclear@0 305 /* FT_GLYPH_BBOX_SUBPIXELS :: */
nuclear@0 306 /* Return unfitted 26.6 coordinates. */
nuclear@0 307 /* */
nuclear@0 308 /* FT_GLYPH_BBOX_GRIDFIT :: */
nuclear@0 309 /* Return grid-fitted 26.6 coordinates. */
nuclear@0 310 /* */
nuclear@0 311 /* FT_GLYPH_BBOX_TRUNCATE :: */
nuclear@0 312 /* Return coordinates in integer pixels. */
nuclear@0 313 /* */
nuclear@0 314 /* FT_GLYPH_BBOX_PIXELS :: */
nuclear@0 315 /* Return grid-fitted pixel coordinates. */
nuclear@0 316 /* */
nuclear@0 317 typedef enum FT_Glyph_BBox_Mode_
nuclear@0 318 {
nuclear@0 319 FT_GLYPH_BBOX_UNSCALED = 0,
nuclear@0 320 FT_GLYPH_BBOX_SUBPIXELS = 0,
nuclear@0 321 FT_GLYPH_BBOX_GRIDFIT = 1,
nuclear@0 322 FT_GLYPH_BBOX_TRUNCATE = 2,
nuclear@0 323 FT_GLYPH_BBOX_PIXELS = 3
nuclear@0 324
nuclear@0 325 } FT_Glyph_BBox_Mode;
nuclear@0 326
nuclear@0 327
nuclear@0 328 /*************************************************************************/
nuclear@0 329 /* */
nuclear@0 330 /* <Enum> */
nuclear@0 331 /* ft_glyph_bbox_xxx */
nuclear@0 332 /* */
nuclear@0 333 /* <Description> */
nuclear@0 334 /* These constants are deprecated. Use the corresponding */
nuclear@0 335 /* @FT_Glyph_BBox_Mode values instead. */
nuclear@0 336 /* */
nuclear@0 337 /* <Values> */
nuclear@0 338 /* ft_glyph_bbox_unscaled :: See @FT_GLYPH_BBOX_UNSCALED. */
nuclear@0 339 /* ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS. */
nuclear@0 340 /* ft_glyph_bbox_gridfit :: See @FT_GLYPH_BBOX_GRIDFIT. */
nuclear@0 341 /* ft_glyph_bbox_truncate :: See @FT_GLYPH_BBOX_TRUNCATE. */
nuclear@0 342 /* ft_glyph_bbox_pixels :: See @FT_GLYPH_BBOX_PIXELS. */
nuclear@0 343 /* */
nuclear@0 344 #define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
nuclear@0 345 #define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
nuclear@0 346 #define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
nuclear@0 347 #define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
nuclear@0 348 #define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
nuclear@0 349
nuclear@0 350
nuclear@0 351 /*************************************************************************/
nuclear@0 352 /* */
nuclear@0 353 /* <Function> */
nuclear@0 354 /* FT_Glyph_Get_CBox */
nuclear@0 355 /* */
nuclear@0 356 /* <Description> */
nuclear@0 357 /* Return a glyph's `control box'. The control box encloses all the */
nuclear@0 358 /* outline's points, including Bézier control points. Though it */
nuclear@0 359 /* coincides with the exact bounding box for most glyphs, it can be */
nuclear@0 360 /* slightly larger in some situations (like when rotating an outline */
nuclear@0 361 /* which contains Bézier outside arcs). */
nuclear@0 362 /* */
nuclear@0 363 /* Computing the control box is very fast, while getting the bounding */
nuclear@0 364 /* box can take much more time as it needs to walk over all segments */
nuclear@0 365 /* and arcs in the outline. To get the latter, you can use the */
nuclear@0 366 /* `ftbbox' component which is dedicated to this single task. */
nuclear@0 367 /* */
nuclear@0 368 /* <Input> */
nuclear@0 369 /* glyph :: A handle to the source glyph object. */
nuclear@0 370 /* */
nuclear@0 371 /* mode :: The mode which indicates how to interpret the returned */
nuclear@0 372 /* bounding box values. */
nuclear@0 373 /* */
nuclear@0 374 /* <Output> */
nuclear@0 375 /* acbox :: The glyph coordinate bounding box. Coordinates are */
nuclear@0 376 /* expressed in 1/64th of pixels if it is grid-fitted. */
nuclear@0 377 /* */
nuclear@0 378 /* <Note> */
nuclear@0 379 /* Coordinates are relative to the glyph origin, using the y~upwards */
nuclear@0 380 /* convention. */
nuclear@0 381 /* */
nuclear@0 382 /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */
nuclear@0 383 /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */
nuclear@0 384 /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */
nuclear@0 385 /* is another name for this constant. */
nuclear@0 386 /* */
nuclear@0 387 /* Note that the maximum coordinates are exclusive, which means that */
nuclear@0 388 /* one can compute the width and height of the glyph image (be it in */
nuclear@0 389 /* integer or 26.6 pixels) as: */
nuclear@0 390 /* */
nuclear@0 391 /* { */
nuclear@0 392 /* width = bbox.xMax - bbox.xMin; */
nuclear@0 393 /* height = bbox.yMax - bbox.yMin; */
nuclear@0 394 /* } */
nuclear@0 395 /* */
nuclear@0 396 /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */
nuclear@0 397 /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */
nuclear@0 398 /* which corresponds to: */
nuclear@0 399 /* */
nuclear@0 400 /* { */
nuclear@0 401 /* bbox.xMin = FLOOR(bbox.xMin); */
nuclear@0 402 /* bbox.yMin = FLOOR(bbox.yMin); */
nuclear@0 403 /* bbox.xMax = CEILING(bbox.xMax); */
nuclear@0 404 /* bbox.yMax = CEILING(bbox.yMax); */
nuclear@0 405 /* } */
nuclear@0 406 /* */
nuclear@0 407 /* To get the bbox in pixel coordinates, set `bbox_mode' to */
nuclear@0 408 /* @FT_GLYPH_BBOX_TRUNCATE. */
nuclear@0 409 /* */
nuclear@0 410 /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */
nuclear@0 411 /* to @FT_GLYPH_BBOX_PIXELS. */
nuclear@0 412 /* */
nuclear@0 413 FT_EXPORT( void )
nuclear@0 414 FT_Glyph_Get_CBox( FT_Glyph glyph,
nuclear@0 415 FT_UInt bbox_mode,
nuclear@0 416 FT_BBox *acbox );
nuclear@0 417
nuclear@0 418
nuclear@0 419 /*************************************************************************/
nuclear@0 420 /* */
nuclear@0 421 /* <Function> */
nuclear@0 422 /* FT_Glyph_To_Bitmap */
nuclear@0 423 /* */
nuclear@0 424 /* <Description> */
nuclear@0 425 /* Convert a given glyph object to a bitmap glyph object. */
nuclear@0 426 /* */
nuclear@0 427 /* <InOut> */
nuclear@0 428 /* the_glyph :: A pointer to a handle to the target glyph. */
nuclear@0 429 /* */
nuclear@0 430 /* <Input> */
nuclear@0 431 /* render_mode :: An enumeration that describes how the data is */
nuclear@0 432 /* rendered. */
nuclear@0 433 /* */
nuclear@0 434 /* origin :: A pointer to a vector used to translate the glyph */
nuclear@0 435 /* image before rendering. Can be~0 (if no */
nuclear@0 436 /* translation). The origin is expressed in */
nuclear@0 437 /* 26.6 pixels. */
nuclear@0 438 /* */
nuclear@0 439 /* destroy :: A boolean that indicates that the original glyph */
nuclear@0 440 /* image should be destroyed by this function. It is */
nuclear@0 441 /* never destroyed in case of error. */
nuclear@0 442 /* */
nuclear@0 443 /* <Return> */
nuclear@0 444 /* FreeType error code. 0~means success. */
nuclear@0 445 /* */
nuclear@0 446 /* <Note> */
nuclear@0 447 /* This function does nothing if the glyph format isn't scalable. */
nuclear@0 448 /* */
nuclear@0 449 /* The glyph image is translated with the `origin' vector before */
nuclear@0 450 /* rendering. */
nuclear@0 451 /* */
nuclear@0 452 /* The first parameter is a pointer to an @FT_Glyph handle, that will */
nuclear@0 453 /* be _replaced_ by this function (with newly allocated data). */
nuclear@0 454 /* Typically, you would use (omitting error handling): */
nuclear@0 455 /* */
nuclear@0 456 /* */
nuclear@0 457 /* { */
nuclear@0 458 /* FT_Glyph glyph; */
nuclear@0 459 /* FT_BitmapGlyph glyph_bitmap; */
nuclear@0 460 /* */
nuclear@0 461 /* */
nuclear@0 462 /* // load glyph */
nuclear@0 463 /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */
nuclear@0 464 /* */
nuclear@0 465 /* // extract glyph image */
nuclear@0 466 /* error = FT_Get_Glyph( face->glyph, &glyph ); */
nuclear@0 467 /* */
nuclear@0 468 /* // convert to a bitmap (default render mode + destroying old) */
nuclear@0 469 /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
nuclear@0 470 /* { */
nuclear@0 471 /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */
nuclear@0 472 /* 0, 1 ); */
nuclear@0 473 /* if ( error ) // `glyph' unchanged */
nuclear@0 474 /* ... */
nuclear@0 475 /* } */
nuclear@0 476 /* */
nuclear@0 477 /* // access bitmap content by typecasting */
nuclear@0 478 /* glyph_bitmap = (FT_BitmapGlyph)glyph; */
nuclear@0 479 /* */
nuclear@0 480 /* // do funny stuff with it, like blitting/drawing */
nuclear@0 481 /* ... */
nuclear@0 482 /* */
nuclear@0 483 /* // discard glyph image (bitmap or not) */
nuclear@0 484 /* FT_Done_Glyph( glyph ); */
nuclear@0 485 /* } */
nuclear@0 486 /* */
nuclear@0 487 /* */
nuclear@0 488 /* Here another example, again without error handling: */
nuclear@0 489 /* */
nuclear@0 490 /* */
nuclear@0 491 /* { */
nuclear@0 492 /* FT_Glyph glyphs[MAX_GLYPHS] */
nuclear@0 493 /* */
nuclear@0 494 /* */
nuclear@0 495 /* ... */
nuclear@0 496 /* */
nuclear@0 497 /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
nuclear@0 498 /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */
nuclear@0 499 /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */
nuclear@0 500 /* */
nuclear@0 501 /* ... */
nuclear@0 502 /* */
nuclear@0 503 /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
nuclear@0 504 /* { */
nuclear@0 505 /* FT_Glyph bitmap = glyphs[idx]; */
nuclear@0 506 /* */
nuclear@0 507 /* */
nuclear@0 508 /* ... */
nuclear@0 509 /* */
nuclear@0 510 /* // after this call, `bitmap' no longer points into */
nuclear@0 511 /* // the `glyphs' array (and the old value isn't destroyed) */
nuclear@0 512 /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */
nuclear@0 513 /* */
nuclear@0 514 /* ... */
nuclear@0 515 /* */
nuclear@0 516 /* FT_Done_Glyph( bitmap ); */
nuclear@0 517 /* } */
nuclear@0 518 /* */
nuclear@0 519 /* ... */
nuclear@0 520 /* */
nuclear@0 521 /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
nuclear@0 522 /* FT_Done_Glyph( glyphs[idx] ); */
nuclear@0 523 /* } */
nuclear@0 524 /* */
nuclear@0 525 FT_EXPORT( FT_Error )
nuclear@0 526 FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
nuclear@0 527 FT_Render_Mode render_mode,
nuclear@0 528 FT_Vector* origin,
nuclear@0 529 FT_Bool destroy );
nuclear@0 530
nuclear@0 531
nuclear@0 532 /*************************************************************************/
nuclear@0 533 /* */
nuclear@0 534 /* <Function> */
nuclear@0 535 /* FT_Done_Glyph */
nuclear@0 536 /* */
nuclear@0 537 /* <Description> */
nuclear@0 538 /* Destroy a given glyph. */
nuclear@0 539 /* */
nuclear@0 540 /* <Input> */
nuclear@0 541 /* glyph :: A handle to the target glyph object. */
nuclear@0 542 /* */
nuclear@0 543 FT_EXPORT( void )
nuclear@0 544 FT_Done_Glyph( FT_Glyph glyph );
nuclear@0 545
nuclear@0 546 /* */
nuclear@0 547
nuclear@0 548
nuclear@0 549 /* other helpful functions */
nuclear@0 550
nuclear@0 551 /*************************************************************************/
nuclear@0 552 /* */
nuclear@0 553 /* <Section> */
nuclear@0 554 /* computations */
nuclear@0 555 /* */
nuclear@0 556 /*************************************************************************/
nuclear@0 557
nuclear@0 558
nuclear@0 559 /*************************************************************************/
nuclear@0 560 /* */
nuclear@0 561 /* <Function> */
nuclear@0 562 /* FT_Matrix_Multiply */
nuclear@0 563 /* */
nuclear@0 564 /* <Description> */
nuclear@0 565 /* Perform the matrix operation `b = a*b'. */
nuclear@0 566 /* */
nuclear@0 567 /* <Input> */
nuclear@0 568 /* a :: A pointer to matrix `a'. */
nuclear@0 569 /* */
nuclear@0 570 /* <InOut> */
nuclear@0 571 /* b :: A pointer to matrix `b'. */
nuclear@0 572 /* */
nuclear@0 573 /* <Note> */
nuclear@0 574 /* The result is undefined if either `a' or `b' is zero. */
nuclear@0 575 /* */
nuclear@0 576 FT_EXPORT( void )
nuclear@0 577 FT_Matrix_Multiply( const FT_Matrix* a,
nuclear@0 578 FT_Matrix* b );
nuclear@0 579
nuclear@0 580
nuclear@0 581 /*************************************************************************/
nuclear@0 582 /* */
nuclear@0 583 /* <Function> */
nuclear@0 584 /* FT_Matrix_Invert */
nuclear@0 585 /* */
nuclear@0 586 /* <Description> */
nuclear@0 587 /* Invert a 2x2 matrix. Return an error if it can't be inverted. */
nuclear@0 588 /* */
nuclear@0 589 /* <InOut> */
nuclear@0 590 /* matrix :: A pointer to the target matrix. Remains untouched in */
nuclear@0 591 /* case of error. */
nuclear@0 592 /* */
nuclear@0 593 /* <Return> */
nuclear@0 594 /* FreeType error code. 0~means success. */
nuclear@0 595 /* */
nuclear@0 596 FT_EXPORT( FT_Error )
nuclear@0 597 FT_Matrix_Invert( FT_Matrix* matrix );
nuclear@0 598
nuclear@0 599
nuclear@0 600 /* */
nuclear@0 601
nuclear@0 602
nuclear@0 603 FT_END_HEADER
nuclear@0 604
nuclear@0 605 #endif /* __FTGLYPH_H__ */
nuclear@0 606
nuclear@0 607
nuclear@0 608 /* END */
nuclear@0 609
nuclear@0 610
nuclear@0 611 /* Local Variables: */
nuclear@0 612 /* coding: utf-8 */
nuclear@0 613 /* End: */