From 6c29ea29fb3b50869967c0c86d3ba6a2ba111e76 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 27 Mar 2011 12:22:13 +0000 Subject: [PATCH] Evas font-engine: Fix font size updating. This commit fixes two types of misupdate of the font size. 1. Not updating all the fonts when not using Harfbuzz. 2. In rare cases update the wrong font when using Harfbuzz. SVN revision: 58114 --- .../src/lib/engines/common/evas_font_draw.c | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/legacy/evas/src/lib/engines/common/evas_font_draw.c b/legacy/evas/src/lib/engines/common/evas_font_draw.c index daa6dfa07d..6ace0324d4 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_draw.c +++ b/legacy/evas/src/lib/engines/common/evas_font_draw.c @@ -500,15 +500,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font (void) use_kerning; #endif - if (fi->src->current_size != fi->size) - { - FTLOCK(); - FT_Activate_Size(fi->ft.size); - FTUNLOCK(); - fi->src->current_size = fi->size; - } - - im = dst->image.data; /* Load the glyph according to the first letter of the script, preety * bad, but will have to do */ @@ -524,6 +515,15 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font if (!*tmp && (tmp > text)) tmp--; evas_common_font_glyph_search(fn, &fi, *tmp); } + + if (fi->src->current_size != fi->size) + { + FTLOCK(); + FT_Activate_Size(fi->ft.size); + FTUNLOCK(); + fi->src->current_size = fi->size; + } + EVAS_FONT_WALK_TEXT_VISUAL_START() { FT_UInt index; @@ -538,6 +538,14 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font * the use of harfbuzz */ index = evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]); + + if (fi->src->current_size != fi->size) + { + FTLOCK(); + FT_Activate_Size(fi->ft.size); + FTUNLOCK(); + fi->src->current_size = fi->size; + } #endif LKL(fi->ft_mutex); fg = evas_common_font_int_cache_glyph_get(fi, index); @@ -828,6 +836,14 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con evas_common_font_glyph_search(fn, &fi, *tmp); } + if (fi->src->current_size != fi->size) + { + FTLOCK(); + FT_Activate_Size(fi->ft.size); + FTUNLOCK(); + fi->src->current_size = fi->size; + } + /* First pass: Work out how big and populate */ /* It's a bit hackish to use index and fg here as they are internal, * but that'll have to be good enough ATM */ @@ -845,6 +861,14 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con * the use of harfbuzz */ index = evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]); + + if (fi->src->current_size != fi->size) + { + FTLOCK(); + FT_Activate_Size(fi->ft.size); + FTUNLOCK(); + fi->src->current_size = fi->size; + } #endif LKL(fi->ft_mutex); fg = evas_common_font_int_cache_glyph_get(fi, index);