summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-02-04 10:07:08 +0000
committerTom Hacohen <tom@stosb.com>2016-02-04 10:07:08 +0000
commit33ea5653477c97072c62c7d7d32b6263b89f8509 (patch)
tree5a41cc817268321a05eac6cb82c7a86ebc7fc8b0 /src/lib/evas/common
parenta7b60528b9735a58440114cc3817bf958e24aca5 (diff)
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
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_font_ot.c5
-rw-r--r--src/lib/evas/common/evas_font_ot.h2
-rw-r--r--src/lib/evas/common/evas_text_utils.c9
-rw-r--r--src/lib/evas/common/evas_text_utils.h2
4 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/evas/common/evas_font_ot.c b/src/lib/evas/common/evas_font_ot.c
index a5fe5b2..3c4d4db 100644
--- a/src/lib/evas/common/evas_font_ot.c
+++ b/src/lib/evas/common/evas_font_ot.c
@@ -268,7 +268,7 @@ _evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi, Evas_Text_Pro
268 268
269EAPI Eina_Bool 269EAPI Eina_Bool
270evas_common_font_ot_populate_text_props(const Eina_Unicode *text, 270evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
271 Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode) 271 Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode, const char *lang)
272{ 272{
273 RGBA_Font_Int *fi; 273 RGBA_Font_Int *fi;
274 hb_buffer_t *buffer; 274 hb_buffer_t *buffer;
@@ -293,8 +293,7 @@ evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
293 293
294 buffer = hb_buffer_create(); 294 buffer = hb_buffer_create();
295 hb_buffer_set_unicode_funcs(buffer, _evas_common_font_ot_unicode_funcs_get()); 295 hb_buffer_set_unicode_funcs(buffer, _evas_common_font_ot_unicode_funcs_get());
296 hb_buffer_set_language(buffer, hb_language_from_string( 296 hb_buffer_set_language(buffer, hb_language_from_string(lang, -1));
297 evas_common_language_from_locale_get(), -1));
298 hb_buffer_set_script(buffer, _evas_script_to_harfbuzz[props->script]); 297 hb_buffer_set_script(buffer, _evas_script_to_harfbuzz[props->script]);
299 hb_buffer_set_direction(buffer, 298 hb_buffer_set_direction(buffer,
300 (props->bidi_dir == EVAS_BIDI_DIRECTION_RTL) ? 299 (props->bidi_dir == EVAS_BIDI_DIRECTION_RTL) ?
diff --git a/src/lib/evas/common/evas_font_ot.h b/src/lib/evas/common/evas_font_ot.h
index 6f66731..fe263db 100644
--- a/src/lib/evas/common/evas_font_ot.h
+++ b/src/lib/evas/common/evas_font_ot.h
@@ -34,6 +34,6 @@ evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_i
34 34
35EAPI Eina_Bool 35EAPI Eina_Bool
36evas_common_font_ot_populate_text_props(const Eina_Unicode *text, 36evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
37 Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode); 37 Evas_Text_Props *props, int len, Evas_Text_Props_Mode mode, const char *lang);
38#endif 38#endif
39 39
diff --git a/src/lib/evas/common/evas_text_utils.c b/src/lib/evas/common/evas_text_utils.c
index bef21fe..9223c6e 100644
--- a/src/lib/evas/common/evas_text_utils.c
+++ b/src/lib/evas/common/evas_text_utils.c
@@ -343,13 +343,13 @@ evas_common_text_props_merge(Evas_Text_Props *item1,
343#ifdef OT_SUPPORT 343#ifdef OT_SUPPORT
344static inline void 344static inline void
345_content_create_ot(RGBA_Font_Int *fi, const Eina_Unicode *text, 345_content_create_ot(RGBA_Font_Int *fi, const Eina_Unicode *text,
346 Evas_Text_Props *text_props, int len, Evas_Text_Props_Mode mode) 346 Evas_Text_Props *text_props, int len, Evas_Text_Props_Mode mode, const char *lang)
347{ 347{
348 size_t char_index; 348 size_t char_index;
349 Evas_Font_Glyph_Info *gl_itr; 349 Evas_Font_Glyph_Info *gl_itr;
350 Evas_Coord pen_x = 0, adjust_x = 0; 350 Evas_Coord pen_x = 0, adjust_x = 0;
351 351
352 evas_common_font_ot_populate_text_props(text, text_props, len, mode); 352 evas_common_font_ot_populate_text_props(text, text_props, len, mode, lang);
353 353
354 gl_itr = text_props->info->glyph; 354 gl_itr = text_props->info->glyph;
355 for (char_index = 0 ; char_index < text_props->len ; char_index++) 355 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,
520EAPI Eina_Bool 520EAPI Eina_Bool
521evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text, 521evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
522 Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, 522 Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
523 size_t par_pos, int len, Evas_Text_Props_Mode mode) 523 size_t par_pos, int len, Evas_Text_Props_Mode mode, const char *lang)
524{ 524{
525 RGBA_Font_Int *fi = (RGBA_Font_Int *) _fi; 525 RGBA_Font_Int *fi = (RGBA_Font_Int *) _fi;
526 526
@@ -558,8 +558,9 @@ evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
558#ifdef OT_SUPPORT 558#ifdef OT_SUPPORT
559 (void) par_props; 559 (void) par_props;
560 (void) par_pos; 560 (void) par_pos;
561 _content_create_ot(fi, text, text_props, len, mode); 561 _content_create_ot(fi, text, text_props, len, mode, lang);
562#else 562#else
563 (void) lang;
563 _content_create_regular(fi, text, text_props, par_props, par_pos, len, mode); 564 _content_create_regular(fi, text, text_props, par_props, par_pos, len, mode);
564#endif 565#endif
565 566
diff --git a/src/lib/evas/common/evas_text_utils.h b/src/lib/evas/common/evas_text_utils.h
index e54046d..2c49dcb 100644
--- a/src/lib/evas/common/evas_text_utils.h
+++ b/src/lib/evas/common/evas_text_utils.h
@@ -157,7 +157,7 @@ evas_common_text_props_script_set(Evas_Text_Props *props, Evas_Script_Type scr);
157EAPI Eina_Bool 157EAPI Eina_Bool
158evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text, 158evas_common_text_props_content_create(void *_fi, const Eina_Unicode *text,
159 Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, 159 Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props,
160 size_t par_pos, int len, Evas_Text_Props_Mode mode); 160 size_t par_pos, int len, Evas_Text_Props_Mode mode, const char *lang);
161 161
162void 162void
163evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst, 163evas_common_text_props_content_copy_and_ref(Evas_Text_Props *dst,