HomePhabricator

evas_textblock: pick textrun fonts

Authored by ali.alzyod on Apr 16 2020, 8:28 PM.

Description

evas_textblock: pick textrun fonts

Summary:
Picking font on textrun, will now give priority into font picked by the user, regardless of script type.
picking font due script can cause many inconvenient results

Example of wrong results: (User font is NotoColorEmoji)

-> add 'a' at the end (notice how text render is wrong)
-> add tab before 'a' (text rendering now is right)

After Change results: (User font is NotoColorEmoji)

-> add 'a' at the end ->
-> add tab before 'a' ->

Also now the following lines will be shown exactly the same, regardless of characters order

"가123A321"
"A321가123"
"123가A321"
"A가123321"

Test Plan:

#include <Elementary.h>
/*
gcc -o example test.c `pkg-config --cflags --libs elementary`
*/

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *en;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("", "");
   elm_win_autodel_set(win, EINA_TRUE);

   en = elm_entry_add(win);
   elm_entry_scrollable_set(en, EINA_TRUE);
   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_entry_text_style_user_push(en,"DEFAULT='font=NotoColorEmoji font_size=30 color=red'");
   elm_object_text_set(en, "&#x262a;123456a");

   evas_object_show(en);

   elm_object_content_set(win, en);
   evas_object_resize(win, 400, 200);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()

Reviewers: woohyun, bowonryu, tasn, raster, cedric

Reviewed By: tasn

Subscribers: cedric, reviewers, committers

Tags: efl

Maniphest Tasks: T8556

Differential Revision: https://phab.enlightenment.org/D11302