# HG changeset patch # User eugeni # Date 1158878207 0 # Node ID 1de67089c19af6951219f401783fb822775db250 # Parent 6a31849e2b803e427cf33479afcc5c97560beb80 Fix FT_Stroker use in libass. The previous variant ended up with 0-width outline in some cases. diff -r 6a31849e2b80 -r 1de67089c19a libass/ass_render.c --- a/libass/ass_render.c Thu Sep 21 19:31:28 2006 +0000 +++ b/libass/ass_render.c Thu Sep 21 22:36:47 2006 +0000 @@ -559,23 +559,7 @@ } if (render_context.face) - { change_font_size(render_context.font_size); - - if (render_context.stroker != 0) { - FT_Stroker_Done(render_context.stroker); - render_context.stroker = 0; - } -#if (FREETYPE_MAJOR > 2) || ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR > 1)) - error = FT_Stroker_New( ass_instance->library, &render_context.stroker ); -#else // < 2.2 - error = FT_Stroker_New( render_context.face->memory, &render_context.stroker ); -#endif - if ( error ) { - mp_msg(MSGT_GLOBAL, MSGL_V, "failed to get stroker\n"); - render_context.stroker = 0; - } - } } /** @@ -584,11 +568,9 @@ */ static void change_border(double border) { - if (!render_context.stroker) { - if (!no_more_font_messages) - mp_msg(MSGT_GLOBAL, MSGL_WARN, "No stroker!\n"); - } else { - int b; + int b; + if (!render_context.face) return; + if (border < 0) { if (render_context.style->BorderStyle == 1) { if (render_context.style->Outline == 0 && render_context.style->Shadow > 0) @@ -601,16 +583,28 @@ render_context.border = border; b = 64 * border * frame_context.border_scale; - if (b > 0) + if (b > 0) { + if (!render_context.stroker) { + int error; +#if (FREETYPE_MAJOR > 2) || ((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR > 1)) + error = FT_Stroker_New( ass_instance->library, &render_context.stroker ); +#else // < 2.2 + error = FT_Stroker_New( render_context.face->memory, &render_context.stroker ); +#endif + if (error) { + mp_msg(MSGT_GLOBAL, MSGL_V, "failed to get stroker\n"); + render_context.stroker = 0; + } + } + if (render_context.stroker) FT_Stroker_Set( render_context.stroker, b, FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0 ); - else { + } else { FT_Stroker_Done(render_context.stroker); render_context.stroker = 0; } - } } #define _r(c) ((c)>>24) @@ -1179,10 +1173,6 @@ static void free_render_context(void) { - if (render_context.stroker != 0) { - FT_Stroker_Done(render_context.stroker); - render_context.stroker = 0; - } } /**