Evas font-engine: Fix the fallback fribidi shaper.

Just keep the shaped string in the string object if fribidi is used
without harfbuzz.

SVN revision: 58620
This commit is contained in:
Tom Hacohen 2011-04-13 08:37:01 +00:00
parent 7220fe7bf3
commit 1dac813ace
4 changed files with 32 additions and 17 deletions

View File

@ -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();

View File

@ -63,6 +63,10 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
#ifdef OT_SUPPORT
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();

View File

@ -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,

View File

@ -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)
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)
{
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;
return evas_common_text_props_content_create(font, text, text_props,
par_props, par_pos, len);
}
static int