summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorali-alzyod <ali198724@gmail.com>2021-01-29 09:05:50 +0200
committerali-alzyod <ali198724@gmail.com>2021-01-29 09:05:51 +0200
commite138962dd75ca15ce4599edbb5d7b2a0946b2c1c (patch)
treef89537f5eb8c299ba59aa5deb9a9a7c0e9e63b65 /src
parent6a3522352b305923fd860505e09a28aed3a5e577 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c4
-rw-r--r--src/tests/evas/evas_test_textblock.c22
2 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index b206d09bb1..f44dfaab5c 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -4372,6 +4372,10 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
4372 (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale), 4372 (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale),
4373 fmt->font.bitmap_scalable); 4373 fmt->font.bitmap_scalable);
4374 } 4374 }
4375 else if (_FMT_INFO(size)) // if font size specified alone, without font
4376 {
4377 fmt->font.size = _FMT_INFO(size);
4378 }
4375 if (_FMT_INFO(gfx_filter_name)) 4379 if (_FMT_INFO(gfx_filter_name))
4376 { 4380 {
4377 if (!fmt->gfx_filter) 4381 if (!fmt->gfx_filter)
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index f78c2888d1..40dbb70967 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -5203,6 +5203,27 @@ EFL_START_TEST(efl_text_font_source)
5203} 5203}
5204EFL_END_TEST 5204EFL_END_TEST
5205 5205
5206EFL_START_TEST(efl_text_default_format)
5207{
5208 Evas *evas;
5209 Eo *txt;
5210 evas = EVAS_TEST_INIT_EVAS();
5211 txt = efl_add(EFL_CANVAS_TEXTBLOCK_CLASS, evas);
5212
5213 Eina_Size2D size;
5214
5215 efl_text_markup_set(txt, "<font=Sans>Hello</font>");
5216
5217 efl_text_font_size_set(txt, 80);
5218 efl_text_color_set(txt, 255, 255, 255, 255);
5219 size = efl_canvas_textblock_size_native_get(txt);
5220
5221 ck_assert_int_gt(size.h, 20);
5222 efl_del(txt);
5223 evas_free(evas);
5224}
5225EFL_END_TEST
5226
5206void evas_test_textblock(TCase *tc) 5227void evas_test_textblock(TCase *tc)
5207{ 5228{
5208 tcase_add_test(tc, evas_textblock_simple); 5229 tcase_add_test(tc, evas_textblock_simple);
@@ -5246,5 +5267,6 @@ void evas_test_textblock(TCase *tc)
5246 tcase_add_test(tc, efl_text_style); 5267 tcase_add_test(tc, efl_text_style);
5247 tcase_add_test(tc, efl_text_markup); 5268 tcase_add_test(tc, efl_text_markup);
5248 tcase_add_test(tc, efl_text_font_source); 5269 tcase_add_test(tc, efl_text_font_source);
5270 tcase_add_test(tc, efl_text_default_format);
5249} 5271}
5250 5272