From a7e1afc5b3bb1963ec9b40f5f0eced8b86a574ca Mon Sep 17 00:00:00 2001 From: eugeni Date: Thu, 21 Sep 2006 22:36:47 +0000 Subject: Fix FT_Stroker use in libass. The previous variant ended up with 0-width outline in some cases. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19924 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) (limited to 'libass') diff --git a/libass/ass_render.c b/libass/ass_render.c index 2b79bda0c5..5008c386a5 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -559,23 +559,7 @@ static void update_font(void) } 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 update_font(void) */ 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 @@ static void change_border(double border) 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 init_render_context(ass_event_t* event) static void free_render_context(void) { - if (render_context.stroker != 0) { - FT_Stroker_Done(render_context.stroker); - render_context.stroker = 0; - } } /** -- cgit v1.2.3