ft_outline_glyph_done( FT_Glyph outline_glyph ) { FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline ); }
ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, FT_GlyphSlot slot ) { FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; FT_Error error = FT_Err_Ok; FT_Library library = FT_GLYPH( glyph )->library; if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { error = FT_Err_Invalid_Glyph_Format; goto Exit; } 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 { FT_Bitmap_New( &glyph->bitmap ); error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap ); } Exit: return error; }
static FT_Error ft_bitmap_glyph_init(FT_BitmapGlyph glyph, FT_GlyphSlot slot) { 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) { error = FT_Err_Invalid_Glyph_Format; 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; if(slot->flags & ft_glyph_own_bitmap) { slot->flags &= ~ft_glyph_own_bitmap; } else { /* copy the bitmap into a new buffer */ error = ft_bitmap_copy(memory, &slot->bitmap, &glyph->bitmap); } Exit: return error; }
ft_outline_glyph_init( FT_Glyph outline_glyph, FT_GlyphSlot slot ) { FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; FT_Error error = FT_Err_Ok; FT_Library library = FT_GLYPH( glyph )->library; FT_Outline* source = &slot->outline; FT_Outline* target = &glyph->outline; /* check format in glyph slot */ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) { error = FT_Err_Invalid_Glyph_Format; goto Exit; } /* allocate new outline */ error = FT_Outline_New( library, source->n_points, source->n_contours, &glyph->outline ); if ( error ) goto Exit; FT_Outline_Copy( source, target ); Exit: return error; }
ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, FT_GlyphSlot slot ) { 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 ) { error = FT_Err_Invalid_Glyph_Format; 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; if ( slot->internal->flags & FT_GLYPH_OWN_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 ); } Exit: return error; }
ft_bitmap_glyph_done( FT_Glyph bitmap_glyph ) { FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; FT_Library library = FT_GLYPH( glyph )->library; FT_Bitmap_Done( library, &glyph->bitmap ); }
ft_bitmap_glyph_done( FT_Glyph bitmap_glyph ) { FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; FT_Memory memory = FT_GLYPH( glyph )->library->memory; FT_FREE( glyph->bitmap.buffer ); }
static void ft_bitmap_glyph_done(FT_BitmapGlyph glyph) { FT_Memory memory = FT_GLYPH(glyph)->library->memory; FREE(glyph->bitmap.buffer); }
ft_outline_glyph_init( FT_Glyph outline_glyph, FT_GlyphSlot slot ) { FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; FT_Error error = FT_Err_Ok; FT_Library library = FT_GLYPH( glyph )->library; FT_Outline* source = &slot->outline; FT_Outline* target = &glyph->outline; /* check format in glyph slot
static FT_Error ft_outline_glyph_copy( FT_OutlineGlyph source, FT_OutlineGlyph target ) { FT_Error error; FT_Library library = FT_GLYPH( source )->library; error = FT_Outline_New( library, source->outline.n_points, source->outline.n_contours, &target->outline ); if ( !error ) FT_Outline_Copy( &source->outline, &target->outline ); return error; }
static FT_Error ft_outline_glyph_init(FT_OutlineGlyph glyph, FT_GlyphSlot slot) { FT_Error error = FT_Err_Ok; FT_Library library = FT_GLYPH(glyph)->library; FT_Outline *source = &slot->outline; FT_Outline *target = &glyph->outline; /* check format in glyph slot */ if(slot->format != ft_glyph_format_outline) { error = FT_Err_Invalid_Glyph_Format; goto Exit; } /* allocate new outline */ error = FT_Outline_New(library, source->n_points, source->n_contours, &glyph->outline); if(error) { goto Exit; } /* copy it */ MEM_Copy(target->points, source->points, source->n_points * sizeof(FT_Vector)); MEM_Copy(target->tags, source->tags, source->n_points * sizeof(FT_Byte)); MEM_Copy(target->contours, source->contours, source->n_contours * sizeof(FT_Short)); /* copy all flags, except the `ft_outline_owner' one */ target->flags = source->flags | ft_outline_owner; Exit: return error; }
ft_outline_glyph_init( FT_Glyph outline_glyph, FT_GlyphSlot slot ) { FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; FT_Error error = FT_Err_Ok; FT_Library library = FT_GLYPH( glyph )->library; FT_Outline* source = &slot->outline; FT_Outline* target = &glyph->outline; /* check format in glyph slot */ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) { error = FT_Err_Invalid_Glyph_Format; goto Exit; } /* allocate new outline */ error = FT_Outline_New( library, source->n_points, source->n_contours, &glyph->outline ); 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; Exit: return error; }
static void ft_outline_glyph_done(FT_OutlineGlyph glyph) { FT_Outline_Done(FT_GLYPH(glyph)->library, &glyph->outline); }