From af9b98bc3b0d53b1f87a89b418bf619ca5d810d5 Mon Sep 17 00:00:00 2001 From: tasn Date: Wed, 13 Apr 2011 08:37:01 +0000 Subject: [PATCH] Evas font-engine: Fix the fallback fribidi shaper. Just keep the shaped string in the string object if fribidi is used without harfbuzz. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58620 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/engines/common/evas_font_draw.c | 6 ++++++ src/lib/engines/common/evas_text_utils.c | 19 ++++++++++++++++++- src/lib/engines/common/evas_text_utils.h | 6 +++++- src/modules/engines/software_generic/evas_engine.c | 20 ++++---------------- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/lib/engines/common/evas_font_draw.c b/src/lib/engines/common/evas_font_draw.c index cc38ad9..e5594cc 100644 --- a/src/lib/engines/common/evas_font_draw.c +++ b/src/lib/engines/common/evas_font_draw.c @@ -414,7 +414,13 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, RGBA_Font_Int *fi, int im_w, int im_h __UNUSED__) { +#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) + (void) in_text; + const Eina_Unicode *text = text_props->info->shaped_text + + text_props->text_offset; +#else const Eina_Unicode *text = in_text; +#endif DATA32 *im; FT_Face pface = NULL; EVAS_FONT_WALK_TEXT_INIT(); diff --git a/src/lib/engines/common/evas_text_utils.c b/src/lib/engines/common/evas_text_utils.c index 261024b..67c3fb2 100644 --- a/src/lib/engines/common/evas_text_utils.c +++ b/src/lib/engines/common/evas_text_utils.c @@ -64,6 +64,10 @@ evas_common_text_props_content_unref(Evas_Text_Props *props) if (props->info->ot) free(props->info->ot); #endif +#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) + if (props->info->shaped_text) + free(props->info->shaped_text); +#endif free(props->info); props->info = NULL; } @@ -171,7 +175,8 @@ evas_common_text_props_merge(Evas_Text_Props *item1, EAPI Eina_Bool evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, - Evas_Text_Props *text_props, int len) + Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, + size_t par_pos, int len) { RGBA_Font *fn = (RGBA_Font *) _fn; RGBA_Font_Int *fi; @@ -202,6 +207,9 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, size_t char_index; Evas_Font_Glyph_Info *gl_itr; const Eina_Unicode *base_char; + (void) par_props; + (void) par_pos; + evas_common_font_ot_populate_text_props(fn, text, text_props, len); /* Load the glyph according to the first letter of the script, preety @@ -266,6 +274,15 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, FT_UInt prev_index; FT_Face pface = NULL; int adv_d, i; +#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) + text = text_props->info->shaped_text = eina_unicode_strndup(text, len); + evas_bidi_shape_string(text_props->info->shaped_text, par_props, par_pos, + len); +#else + (void) par_props; + (void) par_pos; +#endif + FTLOCK(); use_kerning = FT_HAS_KERNING(fi->src->ft.face); FTUNLOCK(); diff --git a/src/lib/engines/common/evas_text_utils.h b/src/lib/engines/common/evas_text_utils.h index 1cddb95..6144ce4 100644 --- a/src/lib/engines/common/evas_text_utils.h +++ b/src/lib/engines/common/evas_text_utils.h @@ -27,6 +27,9 @@ struct _Evas_Text_Props_Info unsigned int refcount; Evas_Font_Glyph_Info *glyph; Evas_Font_OT_Info *ot; +#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) + Eina_Unicode *shaped_text; +#endif }; /* Sorted in visual order when created */ @@ -55,7 +58,8 @@ evas_common_text_props_script_set(Evas_Text_Props *props, EAPI Eina_Bool evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text, - Evas_Text_Props *text_props, int len); + Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, + size_t par_pos, int len); void evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst, diff --git a/src/modules/engines/software_generic/evas_engine.c b/src/modules/engines/software_generic/evas_engine.c index f3b2835..2b47815 100644 --- a/src/modules/engines/software_generic/evas_engine.c +++ b/src/modules/engines/software_generic/evas_engine.c @@ -772,22 +772,10 @@ eng_font_pen_coords_get(void *data __UNUSED__, void *font, const Evas_Text_Props } static Eina_Bool -eng_font_text_props_info_create(void *data __UNUSED__, void *font, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len) -{ - Eina_Bool ret; - (void) par_props; - (void) pos; -#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) - Eina_Unicode *tmp = eina_unicode_strndup(text, len); - text = tmp; - evas_bidi_shape_string(text, par_props, pos, len); -#endif - ret = evas_common_text_props_content_create(font, text, text_props, len); - -#if !defined(OT_SUPPORT) && defined(BIDI_SUPPORT) - free(tmp); -#endif - return ret; +eng_font_text_props_info_create(void *data __UNUSED__, void *font, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len) +{ + return evas_common_text_props_content_create(font, text, text_props, + par_props, par_pos, len); } static int -- 2.7.4