evas/cserve2: Use width and horizontal bearing from

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.



SVN revision: 71132
This commit is contained in:
Rafael Antognolli 2012-05-15 21:15:20 +00:00
parent d94025ca29
commit ad37a5e7bf
3 changed files with 10 additions and 11 deletions

View 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;

View 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))
{

View 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 */