Evas: Use proper language for harfbuzz shaping
Summary: Evas Text, Textblock, Textgrid keeps own language information. This language information could be vary from the result of setlocale(). Especially, Evas Textblock supports <lang> tag. The language could be changed in the middle of text. All of these language has to be used for harfbuzz shaping. @fix Test Plan: N/A Reviewers: herdsman, raster, woohyun, tasn Reviewed By: tasn Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3628
This commit is contained in:
parent
a7b60528b9
commit
33ea565347
|
@ -546,7 +546,8 @@ _evas_object_text_item_new(Evas_Object_Protected_Data *obj,
|
|||
{
|
||||
ENFN->font_text_props_info_create(ENDT,
|
||||
fi, str + pos, &it->text_props,
|
||||
o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
|
||||
o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
|
||||
o->cur.fdesc->lang);
|
||||
_evas_object_text_item_update_sizes(obj, o, it);
|
||||
}
|
||||
o->items = (Evas_Object_Text_Item *)
|
||||
|
|
|
@ -4086,7 +4086,8 @@ skip:
|
|||
{
|
||||
ENFN->font_text_props_info_create(ENDT,
|
||||
cur_fi, str, &ti->text_props, c->par->bidi_props,
|
||||
ti->parent.text_pos, run_len, EVAS_TEXT_PROPS_MODE_SHAPE);
|
||||
ti->parent.text_pos, run_len, EVAS_TEXT_PROPS_MODE_SHAPE,
|
||||
ti->parent.format->font.fdesc->lang);
|
||||
}
|
||||
|
||||
while ((queue->start + queue->off) < (run_start + run_len))
|
||||
|
@ -4765,7 +4766,8 @@ _layout_ellipsis_item_new(Ctxt *c, const Evas_Object_Textblock_Item *cur_it)
|
|||
|
||||
ENFN->font_text_props_info_create(ENDT,
|
||||
cur_fi, _ellip_str, &ellip_ti->text_props,
|
||||
c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
|
||||
c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
|
||||
ellip_ti->parent.format->font.fdesc->lang);
|
||||
}
|
||||
|
||||
_text_item_update_sizes(c, ellip_ti);
|
||||
|
@ -7541,7 +7543,8 @@ _layout_hyphen_item_new(Ctxt *c, const Evas_Object_Textblock_Text_Item *cur_ti)
|
|||
|
||||
ENFN->font_text_props_info_create(ENDT,
|
||||
cur_fi, _hyphen_str, &hyphen_ti->text_props,
|
||||
c->par->bidi_props, hyphen_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
|
||||
c->par->bidi_props, hyphen_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
|
||||
hyphen_ti->parent.format->font.fdesc->lang);
|
||||
}
|
||||
|
||||
_text_item_update_sizes(c, hyphen_ti);
|
||||
|
|
|
@ -189,7 +189,8 @@ evas_object_textgrid_textprop_get(Evas_Object *eo_obj, Evas_Textgrid_Data *o, Ei
|
|||
evas_common_text_props_script_set(&(glyph->props[idx]), script);
|
||||
ENFN->font_text_props_info_create(ENDT, script_fi, &codepoint,
|
||||
&(glyph->props[idx]), NULL, 0, 1,
|
||||
EVAS_TEXT_PROPS_MODE_NONE);
|
||||
EVAS_TEXT_PROPS_MODE_NONE,
|
||||
o->cur.font_description->lang);
|
||||
(*used)++;
|
||||
}
|
||||
else
|
||||
|
@ -1216,7 +1217,8 @@ _evas_textgrid_efl_text_properties_font_set(Eo *eo_obj, Evas_Textgrid_Data *o, c
|
|||
evas_common_text_props_script_set(&text_props, script);
|
||||
ENFN->font_text_props_info_create(ENDT, script_fi, W, &text_props,
|
||||
NULL, 0, 1,
|
||||
EVAS_TEXT_PROPS_MODE_NONE);
|
||||
EVAS_TEXT_PROPS_MODE_NONE,
|
||||
o->cur.font_description->lang);
|
||||
advance = ENFN->font_h_advance_get(ENDT, o->font, &text_props);
|
||||
vadvance = ENFN->font_v_advance_get(ENDT, o->font, &text_props);
|
||||
o->cur.char_width = advance;
|
||||
|
|
|
@ -268,7 +268,7 @@ _evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi, Evas_Text_Pro
|
|||
|
||||
EAPI Eina_Bool
|
||||
evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
|
||||
Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode)
|
||||
Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode, const char *lang)
|
||||
{
|
||||
RGBA_Font_Int *fi;
|
||||
hb_buffer_t *buffer;
|
||||
|
@ -293,8 +293,7 @@ evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
|
|||
|
||||
buffer = hb_buffer_create();
|
||||
hb_buffer_set_unicode_funcs(buffer, _evas_common_font_ot_unicode_funcs_get());
|
||||
hb_buffer_set_language(buffer, hb_language_from_string(
|
||||
evas_common_language_from_locale_get(), -1));
|
||||
hb_buffer_set_language(buffer, hb_language_from_string(lang, -1));
|
||||
hb_buffer_set_script(buffer, _evas_script_to_harfbuzz[props->script]);
|
||||
hb_buffer_set_direction(buffer,
|
||||
(props->bidi_dir == EVAS_BIDI_DIRECTION_RTL) ?
|
||||
|
|
|
@ -34,6 +34,6 @@ evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_i
|
|||
|
||||
EAPI Eina_Bool
|
||||
evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
|
||||
Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode);
|
||||
Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode, const char *lang);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -343,13 +343,13 @@ evas_common_text_props_merge(Evas_Text_Props *item1,
|
|||
#ifdef OT_SUPPORT
|
||||
static inline void
|
||||
_content_create_ot(RGBA_Font_Int *fi, const Eina_Unicode *text,
|
||||
Evas_Text_Props *text_props, int len, Evas_Text_Props_Mode mode)
|
||||
Evas_Text_Props *text_props, int len, Evas_Text_Props_Mode mode, const char *lang)
|
||||
{
|
||||
size_t char_index;
|
||||
Evas_Font_Glyph_Info *gl_itr;
|
||||
Evas_Coord pen_x = 0, adjust_x = 0;
|
||||
|
||||
evas_common_font_ot_populate_text_props(text, text_props, len, mode);
|
||||
evas_common_font_ot_populate_text_props(text, text_props, len, mode, lang);
|
||||
|
||||
gl_itr = text_props->info->glyph;
|
||||
for (char_index = 0 ; char_index < text_props->len ; char_index++)
|
||||
|
@ -520,7 +520,7 @@ _content_create_regular(RGBA_Font_Int *fi, const Eina_Unicode *text,
|
|||
EAPI Eina_Bool
|
||||
evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
|
||||
Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
|
||||
size_t par_pos, int len, Evas_Text_Props_Mode mode)
|
||||
size_t par_pos, int len, Evas_Text_Props_Mode mode, const char *lang)
|
||||
{
|
||||
RGBA_Font_Int *fi = (RGBA_Font_Int *) _fi;
|
||||
|
||||
|
@ -558,8 +558,9 @@ evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
|
|||
#ifdef OT_SUPPORT
|
||||
(void) par_props;
|
||||
(void) par_pos;
|
||||
_content_create_ot(fi, text, text_props, len, mode);
|
||||
_content_create_ot(fi, text, text_props, len, mode, lang);
|
||||
#else
|
||||
(void) lang;
|
||||
_content_create_regular(fi, text, text_props, par_props, par_pos, len, mode);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ evas_common_text_props_script_set(Evas_Text_Props *props, Evas_Script_Type scr);
|
|||
EAPI Eina_Bool
|
||||
evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
|
||||
Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
|
||||
size_t par_pos, int len, Evas_Text_Props_Mode mode);
|
||||
size_t par_pos, int len, Evas_Text_Props_Mode mode, const char *lang);
|
||||
|
||||
void
|
||||
evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,
|
||||
|
|
|
@ -1378,7 +1378,7 @@ struct _Evas_Func
|
|||
void (*image_content_hint_set) (void *data, void *surface, int hint);
|
||||
int (*image_content_hint_get) (void *data, void *surface);
|
||||
int (*font_pen_coords_get) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
|
||||
Eina_Bool (*font_text_props_info_create) (void *data, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len, Evas_Text_Props_Mode mode);
|
||||
Eina_Bool (*font_text_props_info_create) (void *data, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *intl_props, const Evas_BiDi_Paragraph_Props *par_props, size_t pos, size_t len, Evas_Text_Props_Mode mode, const char *lang);
|
||||
int (*font_right_inset_get) (void *data, Evas_Font_Set *font, const Evas_Text_Props *text_props);
|
||||
|
||||
/* EFL-GL Glue Layer */
|
||||
|
|
|
@ -2729,10 +2729,10 @@ eng_font_pen_coords_get(void *data EINA_UNUSED, Evas_Font_Set *font, const Evas_
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_font_text_props_info_create(void *data EINA_UNUSED, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len, Evas_Text_Props_Mode mode)
|
||||
eng_font_text_props_info_create(void *data EINA_UNUSED, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len, Evas_Text_Props_Mode mode, const char *lang)
|
||||
{
|
||||
return evas_common_text_props_content_create((RGBA_Font_Int *) fi, text,
|
||||
text_props, par_props, par_pos, len, mode);
|
||||
text_props, par_props, par_pos, len, mode, lang);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue