evas/cserve2: Use width and horizontal bearing from
authorantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 15 May 2012 21:15:20 +0000 (21:15 +0000)
committerantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 15 May 2012 21:15:20 +0000 (21:15 +0000)
 glyph metrics.
Instead of having to render the glyph to get the width and horizontal
bearing of it, it's possible to get this information from the glyph
metrics (which are available on the glyph slot).

This change now allows Evas to only render the glyph at the rendering
phase, instead of having to render it during layout phase.

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

src/lib/engines/common/evas_font_main.c
src/lib/engines/common/evas_text_utils.c
src/lib/include/evas_common.h

index 1aed305..9356038 100644 (file)
@@ -388,6 +388,10 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx)
         if (fi->fash) _fash_gl_add(fi->fash, idx, (void *)(-1));
         return NULL;
      }
+   fg->width = EVAS_FONT_ROUND_26_6_TO_INT(
+       fi->src->ft.face->glyph->metrics.width);
+   fg->x_bear = EVAS_FONT_ROUND_26_6_TO_INT(
+       fi->src->ft.face->glyph->metrics.horiBearingX);
 
    fg->index = idx;
    fg->fi = fi;
index 741adfa..cea592a 100644 (file)
@@ -337,15 +337,10 @@ evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
              LKU(fi->ft_mutex);
              continue;
           }
-        if ((!fg->glyph_out) && (!evas_common_font_int_cache_glyph_render(fg)))
-          {
-             LKU(fi->ft_mutex);
-             continue;
-          }
         LKU(fi->ft_mutex);
 
-        gl_itr->x_bear = fg->glyph_out->left;
-        gl_itr->width = fg->glyph_out->bitmap.width;
+        gl_itr->x_bear = fg->x_bear;
+        gl_itr->width = fg->width;
         /* text_props->info->glyph[char_index].advance =
          * text_props->info->glyph[char_index].index =
          * already done by the ot function */
@@ -435,8 +430,6 @@ evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
 
         fg = evas_common_font_int_cache_glyph_get(fi, idx);
         if (!fg) continue;
-        if ((!fg->glyph_out) && (!evas_common_font_int_cache_glyph_render(fg)))
-          continue;
         kern = 0;
 
         if ((use_kerning) && (prev_index) && (idx) &&
@@ -453,9 +446,9 @@ evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
         pface = fi->src->ft.face;
 
         gl_itr->index = idx;
-        gl_itr->x_bear = fg->glyph_out->left;
+        gl_itr->x_bear = fg->x_bear;
         adv = fg->glyph->advance.x >> 10;
-        gl_itr->width = fg->glyph_out->bitmap.width;
+        gl_itr->width = fg->width;
 
         if (EVAS_FONT_CHARACTER_IS_INVISIBLE(_gl))
           {
index 65b9ba8..a1c0340 100644 (file)
@@ -965,6 +965,8 @@ struct _RGBA_Font_Source
 struct _RGBA_Font_Glyph
 {
    FT_UInt         index;
+   Evas_Coord      width;
+   Evas_Coord      x_bear;
    FT_Glyph        glyph;
    FT_BitmapGlyph  glyph_out;
    /* this is a problem - only 1 engine at a time can extend such a font... grrr */