evas_textblock: allow default font size to be set without fontname

Reviewers: woohyun, bowonryu, id213sin

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12211
This commit is contained in:
Ali Alzyod 2021-01-29 09:05:50 +02:00
parent 6a3522352b
commit e138962dd7
2 changed files with 26 additions and 0 deletions

View File

@ -4372,6 +4372,10 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
(int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale),
fmt->font.bitmap_scalable);
}
else if (_FMT_INFO(size)) // if font size specified alone, without font
{
fmt->font.size = _FMT_INFO(size);
}
if (_FMT_INFO(gfx_filter_name))
{
if (!fmt->gfx_filter)

View File

@ -5203,6 +5203,27 @@ EFL_START_TEST(efl_text_font_source)
}
EFL_END_TEST
EFL_START_TEST(efl_text_default_format)
{
Evas *evas;
Eo *txt;
evas = EVAS_TEST_INIT_EVAS();
txt = efl_add(EFL_CANVAS_TEXTBLOCK_CLASS, evas);
Eina_Size2D size;
efl_text_markup_set(txt, "<font=Sans>Hello</font>");
efl_text_font_size_set(txt, 80);
efl_text_color_set(txt, 255, 255, 255, 255);
size = efl_canvas_textblock_size_native_get(txt);
ck_assert_int_gt(size.h, 20);
efl_del(txt);
evas_free(evas);
}
EFL_END_TEST
void evas_test_textblock(TCase *tc)
{
tcase_add_test(tc, evas_textblock_simple);
@ -5246,5 +5267,6 @@ void evas_test_textblock(TCase *tc)
tcase_add_test(tc, efl_text_style);
tcase_add_test(tc, efl_text_markup);
tcase_add_test(tc, efl_text_font_source);
tcase_add_test(tc, efl_text_default_format);
}