Evas font-engine: Fix font size updating.
authorTom Hacohen <tom@stosb.com>
Sun, 27 Mar 2011 12:22:13 +0000 (12:22 +0000)
committerTom Hacohen <tom@stosb.com>
Sun, 27 Mar 2011 12:22:13 +0000 (12:22 +0000)
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

legacy/evas/src/lib/engines/common/evas_font_draw.c

index daa6dfa07deb6f5b665668395e9745561d890b0a..6ace0324d472c95f3579840f4e28de42e1d210ec 100644 (file)
@@ -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);