Revert "BAD TASN!". Yeah, I'm evil.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 26 Apr 2011 14:20:41 +0000 (14:20 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 26 Apr 2011 14:20:41 +0000 (14:20 +0000)
Following commit includes a fix.

This reverts commit 58933.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58935 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_font_draw.c
src/lib/engines/common/evas_text_utils.c
src/lib/engines/common/evas_text_utils.h

index 5ea57ec..5ec77f6 100644 (file)
@@ -420,6 +420,12 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
       in_text;
 #else
    const Eina_Unicode *text = in_text;
+   /* Not relevant in the Harfbuzz case, and will soon will not be relevant
+    * at all */
+   (void) text;
+   /* Should be marked as unused? or should I do something fancy about it to
+    * make sure the given fi is relevant? */
+   (void) fn;
 #endif
    DATA32 *im;
    FT_Face pface = NULL;
@@ -515,21 +521,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
 #endif
 
    im = dst->image.data;
-   /* Load the glyph according to the first letter of the script, preety
-    * bad, but will have to do */
-     {
-        /* Skip common chars */
-        const Eina_Unicode *tmp;
-        for (tmp = text ;
-              ((size_t) (tmp - text) < text_props->text_len) &&
-              evas_common_language_char_script_get(*tmp) ==
-              EVAS_SCRIPT_COMMON ;
-              tmp++)
-          ;
-        if (((size_t) (tmp - text) == text_props->text_len) && (tmp > text))
-           tmp--;
-        evas_common_font_glyph_search(fn, &fi, *tmp);
-     }
+   fi = text_props->font_instance;
+   evas_common_font_int_reload(fi);
 
    if (fi->src->current_size != fi->size)
      {
@@ -843,20 +836,8 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con
    gl = dc->font_ext.func.gl_new ? 1: 0;
 
    above = 0; below = 0; baseline = 0; height = 0; descent = 0;
-   /* Load the glyph according to the first letter of the script, preety
-    * bad, but will have to do */
-     {
-        /* Skip common chars */
-        const Eina_Unicode *tmp;
-        for (tmp = text ;
-              ((tmp - text) < len) &&
-              evas_common_language_char_script_get(*tmp) ==
-              EVAS_SCRIPT_COMMON ;
-              tmp++)
-          ;
-        if (((tmp - text) == len) && (tmp > text)) tmp--;
-        evas_common_font_glyph_search(fn, &fi, *tmp);
-     }
+   fi = text_props->font_instance;
+   evas_common_font_int_reload(fi);
 
    if (fi->src->current_size != fi->size)
      {
index b79ffca..83c7d89 100644 (file)
@@ -203,18 +203,12 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
      }
 
 #ifdef OT_SUPPORT
-   size_t char_index;
-   Evas_Font_Glyph_Info *gl_itr;
-   const Eina_Unicode *base_char;
-   Evas_Coord pen_x = 0, adjust_x = 0;
-   (void) par_props;
-   (void) par_pos;
-
-   evas_common_font_ot_populate_text_props(fn, text, text_props, len);
-
+   /* FIXME: as soon as we start caching fi for non-harfbuzz as well, move
+    * this (until text_props->fi = fi outside the ifdef */
    /* Load the glyph according to the first letter of the script, preety
     * bad, but will have to do */
      {
+        const Eina_Unicode *base_char;
         /* Skip common chars */
         for (base_char = text ;
              *base_char &&
@@ -226,6 +220,17 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
         evas_common_font_glyph_search(fn, &fi, *base_char);
      }
 
+   text_props->font_instance = fi;
+
+
+   size_t char_index;
+   Evas_Font_Glyph_Info *gl_itr;
+   Evas_Coord pen_x = 0, adjust_x = 0;
+   (void) par_props;
+   (void) par_pos;
+
+   evas_common_font_ot_populate_text_props(fn, text, text_props, len);
+
    gl_itr = text_props->info->glyph;
    for (char_index = 0 ; char_index < text_props->len ; char_index++)
      {
@@ -235,6 +240,7 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
         /* If we got a malformed index, show the replacement char instead */
         if (gl_itr->index == 0)
           {
+             /* FIXME: search inside the same fi. */
              gl_itr->index =
                 evas_common_font_glyph_search(fn, &fi, REPLACEMENT_CHAR);
              is_replacement = EINA_TRUE;
@@ -275,14 +281,12 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
                   /* Update the advance accordingly */
                   adjust_x += (pen_x + (fg->glyph->advance.x >> 16)) -
                      gl_itr->pen_after;
-
-                  /* FIXME: reload fi, a bit slow, but I have no choice. */
-                  evas_common_font_glyph_search(fn, &fi, *base_char);
                }
              pen_x = gl_itr->pen_after;
           }
         gl_itr->pen_after += adjust_x;
 
+        fi = text_props->font_instance;
         gl_itr++;
      }
 #else
index 687827a..d69cfd0 100644 (file)
@@ -23,6 +23,7 @@ struct _Evas_Text_Props
    Evas_BiDi_Props bidi;
    Evas_Script_Type script;
    Evas_Text_Props_Info *info;
+   void *font_instance;
 
    /* FIXME: just a hack in the meanwhile, remove when I can finally cache
     * fi and split to scripts without harfbuzz */