From cf7dafaf7e6d60a6403009b841f31eec33913ca0 Mon Sep 17 00:00:00 2001 From: tasn Date: Mon, 2 May 2011 09:28:00 +0000 Subject: [PATCH] Evas font-engine: Cache fi for all cases (even without harfbuzz). This is now possible, because we have a script querying function. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@59109 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/engines/common/evas_font_draw.c | 54 +++----------------------------- src/lib/engines/common/evas_text_utils.c | 14 +++------ 2 files changed, 8 insertions(+), 60 deletions(-) diff --git a/src/lib/engines/common/evas_font_draw.c b/src/lib/engines/common/evas_font_draw.c index c20c921..d099ace 100644 --- a/src/lib/engines/common/evas_font_draw.c +++ b/src/lib/engines/common/evas_font_draw.c @@ -518,12 +518,13 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font # endif } } +#else + (void) text; + (void) fn; #endif im = dst->image.data; -#ifdef OT_SUPPORT - /* FIXME-tom: Should be applied to non-ot as well once we are capable of - * doing it */ + fi = text_props->font_instance; if (fi) { @@ -537,7 +538,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font fi->src->current_size = fi->size; } } -#endif EVAS_FONT_WALK_TEXT_START() { @@ -546,31 +546,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font int chr_x, chr_y, chr_w; if (!EVAS_FONT_WALK_IS_VISIBLE) continue; -#ifdef OT_SUPPORT index = EVAS_FONT_WALK_INDEX; -#else - /* FIXME: Should be removed once we split according to script without - * the use of harfbuzz */ - if (text_props->repch) - index = - evas_common_font_glyph_search(fn, &fi, text_props->repch); - else - index = - evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]); - if (index == 0) - { - index = evas_common_font_glyph_search(fn, &fi, REPLACEMENT_CHAR); - } - - 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); if (!fg) @@ -843,9 +820,6 @@ 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; -#ifdef OT_SUPPORT - /* FIXME-tom: Should be applied to non-ot as well once we are capable of - * doing it */ fi = text_props->font_instance; if (fi) { @@ -859,7 +833,6 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con fi->src->current_size = fi->size; } } -#endif /* First pass: Work out how big and populate */ /* It's a bit hackish to use index and fg here as they are internal, @@ -871,26 +844,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con { FT_UInt index; RGBA_Font_Glyph *fg; -#ifdef OT_SUPPORT index = EVAS_FONT_WALK_INDEX; -#else - /* FIXME: Should be removed once we split according to script without - * the use of harfbuzz */ - if (text_props->repch) - index = - evas_common_font_glyph_search(fn, &fi, text_props->repch); - else - 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); if (!fg) diff --git a/src/lib/engines/common/evas_text_utils.c b/src/lib/engines/common/evas_text_utils.c index 4aa46ee..154332f 100644 --- a/src/lib/engines/common/evas_text_utils.c +++ b/src/lib/engines/common/evas_text_utils.c @@ -202,18 +202,15 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, fi->src->current_size = fi->size; } -#ifdef OT_SUPPORT - /* 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 + /* Load the glyph according to the first letter of the script, pretty * bad, but will have to do */ { const Eina_Unicode *base_char; /* Skip common chars */ for (base_char = text ; *base_char && - evas_common_language_char_script_get(*base_char) == - EVAS_SCRIPT_COMMON ; + (evas_common_language_char_script_get(*base_char) != + text_props->script) ; base_char++) ; if (!*base_char && (base_char > text)) base_char--; @@ -222,7 +219,7 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, text_props->font_instance = fi; - +#ifdef OT_SUPPORT size_t char_index; Evas_Font_Glyph_Info *gl_itr; Evas_Coord pen_x = 0, adjust_x = 0; @@ -290,9 +287,6 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, gl_itr++; } #else - /* FIXME: Move outside when we can (read comment above). */ - text_props->font_instance = NULL; - /* We are walking the string in visual ordering */ Evas_Font_Glyph_Info *gl_itr; Eina_Bool use_kerning; -- 2.7.4