ft_outline_glyph_done( FT_Glyph outline_glyph ) { FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline ); }
/* * \brief Free a drawing */ void ass_drawing_free(ASS_Drawing* drawing) { if (drawing) { free(drawing->text); FT_Outline_Done(drawing->ftlibrary, &drawing->outline); } free(drawing); }
static void Py_Outline_dealloc(Py_Outline* self) { if (self->inited) { FT_Outline_Done(get_ft_library(), &self->x); } PyMem_Free(self->points); PyMem_Free(self->codes); Py_TYPE(self)->tp_clear((PyObject*)self); Py_TYPE(self)->tp_free((PyObject*)self); }
/* * \brief Get and prepare a FreeType glyph */ static void drawing_make_glyph(ASS_Drawing *drawing, void *fontconfig_priv, ASS_Font *font) { FT_OutlineGlyph glyph; // This is hacky... glyph = (FT_OutlineGlyph) ass_font_get_glyph(fontconfig_priv, font, (uint32_t) ' ', 0, 0); if (glyph) { FT_Outline_Done(drawing->ftlibrary, &glyph->outline); FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS, GLYPH_INITIAL_CONTOURS, &glyph->outline); glyph->outline.n_contours = 0; glyph->outline.n_points = 0; glyph->root.advance.x = glyph->root.advance.y = 0; } drawing->glyph = glyph; }
FT_Error ft_OutlineStroke( FT_Library library, FT_Outline *Outline, int Thickness ) { FT_Error err = 0; FT_Outline OutlineReversed; FT_Outline OutlineFattened; FT_Outline OutlineStroke; if ( Outline == NULL ) { goto failure; } err = FT_Outline_New( library, Outline->n_points, Outline->n_contours, &OutlineReversed ); if ( err != 0 ) { goto failure; } err = FT_Outline_New( library, Outline->n_points, Outline->n_contours, &OutlineFattened ); if ( err != 0 ) { goto failure; } err = FT_Outline_Copy( Outline, &OutlineReversed ); if ( err != 0 ) { goto failure; } err = FT_Outline_Copy( Outline, &OutlineFattened ); if ( err != 0 ) { goto failure; } err = FT_Outline_New( library, Outline->n_points * 2, Outline->n_contours * 2, &OutlineStroke ); if ( err != 0 ) { goto failure; } /* Perform fattening operation */ err = FT_Outline_Embolden( &OutlineFattened, Thickness << 1 ); if ( err != 0 ) { goto failure; } /* Perform reversal operation */ ft_OutlineReverse( Outline, &OutlineReversed ); FT_Outline_Translate( &OutlineReversed, Thickness, Thickness ); /* Merge outlines */ ft_OutlineMerge( &OutlineFattened, &OutlineReversed, &OutlineStroke ); /* delete temporary and input outline */ err = FT_Outline_Done( library, &OutlineReversed ); if ( err != 0 ) { goto failure; } err = FT_Outline_Done( library, &OutlineFattened ); if ( err != 0 ) { goto failure; } err = FT_Outline_Done( library, Outline ); if ( err != 0 ) { goto failure; } /* finally copy the outline - its not clear from ft docs if this does the right thing but i _think_ its correct */ memcpy( Outline, &OutlineStroke, sizeof( FT_Outline ) ); return 0; failure: return err; }
static void ft_outline_glyph_done(FT_OutlineGlyph glyph) { FT_Outline_Done(FT_GLYPH(glyph)->library, &glyph->outline); }