forked from enlightenment/efl
evas textblock : update font source when it set using font_source_set
Summary: when we set font source, for example with efl_text_font_source_set, the font source will not be updated in the textblock. this is have same results that has been done in D9548 Test Plan: #define EFL_EO_API_SUPPORT 1 #define EFL_BETA_API_SUPPORT 1 #include <Efl_Ui.h> static void _gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) { efl_exit(0); } static Eo * _create_label(Eo *win, Eo *bx) { Eo *en; en = efl_add(EFL_UI_TEXTBOX_CLASS, win); printf("Added Efl.Ui.Text object\n"); efl_text_interactive_editable_set(en, EINA_FALSE); efl_pack(bx, en); return en; } static void _gui_setup() { char buf[512], f_buf[512]; Eo *win, *bx; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), efl_text_set(efl_added, "Hello World"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); // when the user clicks "close" on a window there is a request to delete efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL); bx = efl_add(EFL_UI_BOX_CLASS, win, efl_content_set(win, efl_added), efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240))); snprintf(buf, sizeof(buf), "./TestFontSource.eet"); Eo *en = _create_label(win, bx); efl_text_set(en, "Hello, This Text Use The Font : Does_Not_Exists_Font_1 : Source + Font Name"); efl_text_font_source_set(en, buf); efl_text_font_family_set(en, "Does_Not_Exists_Font_1"); efl_text_font_size_set(en, 35); en = _create_label(win, bx); efl_text_set(en, "Hello, This Text Use The Font : Does_Not_Exists_Font_1 : Font Name"); efl_text_font_family_set(en, "Does_Not_Exists_Font_1"); efl_text_font_size_set(en, 35); en = _create_label(win, bx); efl_text_set(en, "Hello, This Text Use The Font : Does_Not_Exists_Font_2 : Source + Font Name"); efl_text_font_source_set(en, buf); efl_text_font_family_set(en, "Does_Not_Exists_Font_2"); efl_text_font_size_set(en, 35); en = _create_label(win, bx); efl_text_set(en, "Hello, This Text Use The Font : Does_Not_Exists_Font_2 : Font Name"); efl_text_font_family_set(en, "Does_Not_Exists_Font_2"); efl_text_font_size_set(en, 35); } EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) { _gui_setup(); } EFL_MAIN() Reviewers: ali.alzyod, woohyun, bowonryu, cedric Reviewed By: ali.alzyod Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11757
This commit is contained in:
parent
1bbd03b768
commit
c43630c22a
|
@ -4343,6 +4343,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
|
|||
fmt->font.fdesc->weight = _FMT_INFO(font_weight);
|
||||
fmt->font.fdesc->slant = _FMT_INFO(font_slant);
|
||||
fmt->font.fdesc->width = _FMT_INFO(font_width);
|
||||
eina_stringshare_replace(&(fmt->font.source), _FMT_INFO(font_source));
|
||||
evas_font_name_parse(fmt->font.fdesc, _FMT_INFO(font));
|
||||
fmt->font.font = evas_font_load(evas_obj->layer->evas->font_path,
|
||||
evas_obj->layer->evas->hinting,
|
||||
|
|
|
@ -27,6 +27,7 @@ _evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n);
|
|||
/* end of functions defined in evas_object_textblock.c */
|
||||
|
||||
#define TEST_FONT "font=DejaVuSans,UnDotum,malayalam font_source=" TESTS_SRC_DIR "/fonts/TestFont.eet"
|
||||
#define TEST_FONT_SOURCE TESTS_SRC_DIR "/fonts/TestFontSource.eet"
|
||||
|
||||
static const char *style_buf =
|
||||
"DEFAULT='" TEST_FONT " font_size=10 color=#000 text_class=entry'"
|
||||
|
@ -5075,6 +5076,36 @@ EFL_START_TEST(efl_text_markup)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(efl_text_font_source)
|
||||
{
|
||||
START_EFL_CANVAS_TEXTBLOCK_TEST();
|
||||
|
||||
Eina_Size2D size1, size2;
|
||||
|
||||
efl_canvas_textblock_style_apply(txt,"\tfont_size=30\t");
|
||||
efl_text_markup_set(txt, "Hello, This Text Use The Font : Does_Not_Exists_Font");
|
||||
|
||||
efl_text_font_family_set(txt, "Does_Not_Exists_Font_1");
|
||||
size1 = efl_canvas_textblock_size_native_get(txt);
|
||||
|
||||
efl_text_font_source_set(txt, TEST_FONT_SOURCE);
|
||||
efl_text_font_family_set(txt, "Does_Not_Exists_Font_1");
|
||||
size2 = efl_canvas_textblock_size_native_get(txt);
|
||||
ck_assert_int_ne(size1.w, size2.w);
|
||||
|
||||
efl_text_font_source_set(txt, "");
|
||||
efl_text_font_family_set(txt, "Does_Not_Exists_Font_2");
|
||||
size1 = efl_canvas_textblock_size_native_get(txt);
|
||||
|
||||
efl_text_font_source_set(txt, TEST_FONT_SOURCE);
|
||||
efl_text_font_family_set(txt, "Does_Not_Exists_Font_2");
|
||||
size2 = efl_canvas_textblock_size_native_get(txt);
|
||||
ck_assert_int_ne(size1.w, size2.w);
|
||||
|
||||
END_EFL_CANVAS_TEXTBLOCK_TEST();
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void evas_test_textblock(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, evas_textblock_simple);
|
||||
|
@ -5115,5 +5146,6 @@ void evas_test_textblock(TCase *tc)
|
|||
tcase_add_test(tc, efl_canvas_textblock_style);
|
||||
tcase_add_test(tc, efl_text_style);
|
||||
tcase_add_test(tc, efl_text_markup);
|
||||
tcase_add_test(tc, efl_text_font_source);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue