| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftglyph.c */ | 3 /* ftglyph.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* FreeType convenience functions to handle glyphs (body). */ | 5 /* FreeType convenience functions to handle glyphs (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010 by */ | 7 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 | 248 |
| 249 slot->format = FT_GLYPH_FORMAT_OUTLINE; | 249 slot->format = FT_GLYPH_FORMAT_OUTLINE; |
| 250 slot->outline = glyph->outline; | 250 slot->outline = glyph->outline; |
| 251 slot->outline.flags &= ~FT_OUTLINE_OWNER; | 251 slot->outline.flags &= ~FT_OUTLINE_OWNER; |
| 252 | 252 |
| 253 return FT_Err_Ok; | 253 return FT_Err_Ok; |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 FT_DEFINE_GLYPH( ft_outline_glyph_class, | 257 FT_DEFINE_GLYPH( ft_outline_glyph_class, |
| 258 sizeof ( FT_OutlineGlyphRec ), | 258 sizeof ( FT_OutlineGlyphRec ), |
| 259 FT_GLYPH_FORMAT_OUTLINE, | 259 FT_GLYPH_FORMAT_OUTLINE, |
| 260 | 260 |
| 261 ft_outline_glyph_init, | 261 ft_outline_glyph_init, |
| 262 ft_outline_glyph_done, | 262 ft_outline_glyph_done, |
| 263 ft_outline_glyph_copy, | 263 ft_outline_glyph_copy, |
| 264 ft_outline_glyph_transform, | 264 ft_outline_glyph_transform, |
| 265 ft_outline_glyph_bbox, | 265 ft_outline_glyph_bbox, |
| 266 ft_outline_glyph_prepare | 266 ft_outline_glyph_prepare |
| 267 ) | 267 ) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, | 505 FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, |
| 506 FT_Render_Mode render_mode, | 506 FT_Render_Mode render_mode, |
| 507 FT_Vector* origin, | 507 FT_Vector* origin, |
| 508 FT_Bool destroy ) | 508 FT_Bool destroy ) |
| 509 { | 509 { |
| 510 FT_GlyphSlotRec dummy; | 510 FT_GlyphSlotRec dummy; |
| 511 FT_GlyphSlot_InternalRec dummy_internal; | 511 FT_GlyphSlot_InternalRec dummy_internal; |
| 512 FT_Error error = FT_Err_Ok; | 512 FT_Error error = FT_Err_Ok; |
| 513 FT_Glyph glyph; | 513 FT_Glyph glyph; |
| 514 FT_BitmapGlyph bitmap = NULL; | 514 FT_BitmapGlyph bitmap = NULL; |
| 515 | |
| 516 const FT_Glyph_Class* clazz; | 515 const FT_Glyph_Class* clazz; |
| 517 | 516 |
| 518 #ifdef FT_CONFIG_OPTION_PIC | 517 /* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */ |
| 519 FT_Library library = FT_GLYPH( glyph )->library; | 518 FT_Library library; |
| 520 #endif | |
| 521 | 519 |
| 522 | 520 |
| 523 /* check argument */ | 521 /* check argument */ |
| 524 if ( !the_glyph ) | 522 if ( !the_glyph ) |
| 525 goto Bad; | 523 goto Bad; |
| 526 | |
| 527 /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ | |
| 528 /* then calling FT_Render_Glyph_Internal() */ | |
| 529 | |
| 530 glyph = *the_glyph; | 524 glyph = *the_glyph; |
| 531 if ( !glyph ) | 525 if ( !glyph ) |
| 532 goto Bad; | 526 goto Bad; |
| 533 | 527 |
| 534 clazz = glyph->clazz; | 528 clazz = glyph->clazz; |
| 529 library = glyph->library; |
| 530 if ( !library || !clazz ) |
| 531 goto Bad; |
| 535 | 532 |
| 536 /* when called with a bitmap glyph, do nothing and return successfully */ | 533 /* when called with a bitmap glyph, do nothing and return successfully */ |
| 537 if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) | 534 if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) |
| 538 goto Exit; | 535 goto Exit; |
| 539 | 536 |
| 540 if ( !clazz || !clazz->glyph_prepare ) | 537 if ( !clazz->glyph_prepare ) |
| 541 goto Bad; | 538 goto Bad; |
| 542 | 539 |
| 540 /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ |
| 541 /* then calling FT_Render_Glyph_Internal() */ |
| 542 |
| 543 FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); | 543 FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); |
| 544 FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); | 544 FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); |
| 545 dummy.internal = &dummy_internal; | 545 dummy.internal = &dummy_internal; |
| 546 dummy.library = glyph->library; | 546 dummy.library = library; |
| 547 dummy.format = clazz->glyph_format; | 547 dummy.format = clazz->glyph_format; |
| 548 | 548 |
| 549 /* create result bitmap glyph */ | 549 /* create result bitmap glyph */ |
| 550 error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET, | 550 error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, |
| 551 (FT_Glyph*)(void*)&bitmap ); | 551 (FT_Glyph*)(void*)&bitmap ); |
| 552 if ( error ) | 552 if ( error ) |
| 553 goto Exit; | 553 goto Exit; |
| 554 | 554 |
| 555 #if 1 | 555 #if 1 |
| 556 /* if `origin' is set, translate the glyph image */ | 556 /* if `origin' is set, translate the glyph image */ |
| 557 if ( origin ) | 557 if ( origin ) |
| 558 FT_Glyph_Transform( glyph, 0, origin ); | 558 FT_Glyph_Transform( glyph, 0, origin ); |
| 559 #else | 559 #else |
| 560 FT_UNUSED( origin ); | 560 FT_UNUSED( origin ); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 | 618 |
| 619 if ( clazz->glyph_done ) | 619 if ( clazz->glyph_done ) |
| 620 clazz->glyph_done( glyph ); | 620 clazz->glyph_done( glyph ); |
| 621 | 621 |
| 622 FT_FREE( glyph ); | 622 FT_FREE( glyph ); |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 | 625 |
| 626 | 626 |
| 627 /* END */ | 627 /* END */ |
| OLD | NEW |