|
|
|
@ -31,6 +31,7 @@ |
|
|
|
|
#include <ft2build.h> |
|
|
|
|
#include FT_GLYPH_H |
|
|
|
|
#include FT_OUTLINE_H |
|
|
|
|
#include FT_BITMAP_H |
|
|
|
|
#include FT_INTERNAL_OBJECTS_H |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -114,30 +115,6 @@ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
static FT_Error |
|
|
|
|
ft_bitmap_copy( FT_Memory memory, |
|
|
|
|
FT_Bitmap* source, |
|
|
|
|
FT_Bitmap* target ) |
|
|
|
|
{ |
|
|
|
|
FT_Error error; |
|
|
|
|
FT_Int pitch = source->pitch; |
|
|
|
|
FT_ULong size; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*target = *source; |
|
|
|
|
|
|
|
|
|
if ( pitch < 0 ) |
|
|
|
|
pitch = -pitch; |
|
|
|
|
|
|
|
|
|
size = (FT_ULong)( pitch * source->rows ); |
|
|
|
|
|
|
|
|
|
if ( !FT_ALLOC( target->buffer, size ) ) |
|
|
|
|
FT_MEM_COPY( target->buffer, source->buffer, size ); |
|
|
|
|
|
|
|
|
|
return error; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error ) |
|
|
|
|
ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, |
|
|
|
|
FT_GlyphSlot slot ) |
|
|
|
@ -145,7 +122,6 @@ |
|
|
|
|
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; |
|
|
|
|
FT_Error error = FT_Err_Ok; |
|
|
|
|
FT_Library library = FT_GLYPH( glyph )->library; |
|
|
|
|
FT_Memory memory = library->memory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) |
|
|
|
@ -154,17 +130,19 @@ |
|
|
|
|
goto Exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* grab the bitmap in the slot - do lazy copying whenever possible */ |
|
|
|
|
glyph->bitmap = slot->bitmap; |
|
|
|
|
glyph->left = slot->bitmap_left; |
|
|
|
|
glyph->top = slot->bitmap_top; |
|
|
|
|
glyph->left = slot->bitmap_left; |
|
|
|
|
glyph->top = slot->bitmap_top; |
|
|
|
|
|
|
|
|
|
/* do lazy copying whenever possible */ |
|
|
|
|
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) |
|
|
|
|
{ |
|
|
|
|
glyph->bitmap = slot->bitmap; |
|
|
|
|
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
/* copy the bitmap into a new buffer */ |
|
|
|
|
error = ft_bitmap_copy( memory, &slot->bitmap, &glyph->bitmap ); |
|
|
|
|
FT_Bitmap_New( &glyph->bitmap ); |
|
|
|
|
error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Exit: |
|
|
|
@ -176,26 +154,26 @@ |
|
|
|
|
ft_bitmap_glyph_copy( FT_Glyph bitmap_source, |
|
|
|
|
FT_Glyph bitmap_target ) |
|
|
|
|
{ |
|
|
|
|
FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source; |
|
|
|
|
FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target; |
|
|
|
|
FT_Memory memory = bitmap_source->library->memory; |
|
|
|
|
FT_Library library = bitmap_source->library; |
|
|
|
|
FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source; |
|
|
|
|
FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target->left = source->left; |
|
|
|
|
target->top = source->top; |
|
|
|
|
|
|
|
|
|
return ft_bitmap_copy( memory, &source->bitmap, &target->bitmap ); |
|
|
|
|
return FT_Bitmap_Copy( library, &source->bitmap, &target->bitmap ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void ) |
|
|
|
|
ft_bitmap_glyph_done( FT_Glyph bitmap_glyph ) |
|
|
|
|
{ |
|
|
|
|
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; |
|
|
|
|
FT_Memory memory = FT_GLYPH( glyph )->library->memory; |
|
|
|
|
FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; |
|
|
|
|
FT_Library library = FT_GLYPH( glyph )->library; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_FREE( glyph->bitmap.buffer ); |
|
|
|
|
FT_Bitmap_Done( library, &glyph->bitmap ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -261,15 +239,7 @@ |
|
|
|
|
if ( error ) |
|
|
|
|
goto Exit; |
|
|
|
|
|
|
|
|
|
/* copy it */ |
|
|
|
|
FT_ARRAY_COPY( target->points, source->points, source->n_points ); |
|
|
|
|
|
|
|
|
|
FT_ARRAY_COPY( target->tags, source->tags, source->n_points ); |
|
|
|
|
|
|
|
|
|
FT_ARRAY_COPY( target->contours, source->contours, source->n_contours ); |
|
|
|
|
|
|
|
|
|
/* copy all flags, except the `FT_OUTLINE_OWNER' one */ |
|
|
|
|
target->flags = source->flags | FT_OUTLINE_OWNER; |
|
|
|
|
FT_Outline_Copy( source, target ); |
|
|
|
|
|
|
|
|
|
Exit: |
|
|
|
|
return error; |
|
|
|
|