forked from enlightenment/efl
Evas textblock: Apply scale factor to <linesize>, <linegap> formats
Summary: Font size is scaled according to scale factor. The linesize, linegap formats also have to be scaled properly. @fix Test Plan: Test cases are included. Run "make check" Reviewers: woohyun, Jieun, tasn, herdsman Reviewed By: tasn Subscribers: raster, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3688
This commit is contained in:
parent
743880a175
commit
64e0dc341d
|
@ -2716,10 +2716,11 @@ _layout_format_ascent_descent_adjust(const Evas_Object *eo_obj,
|
|||
descent = *maxdescent;
|
||||
if (fmt->linesize > 0)
|
||||
{
|
||||
if ((ascent + descent) < fmt->linesize)
|
||||
int scaled_linesize = fmt->linesize * obj->cur->scale;
|
||||
if ((ascent + descent) < scaled_linesize)
|
||||
{
|
||||
ascent = ((fmt->linesize * ascent) / (ascent + descent));
|
||||
descent = fmt->linesize - ascent;
|
||||
ascent = ((scaled_linesize * ascent) / (ascent + descent));
|
||||
descent = scaled_linesize - ascent;
|
||||
}
|
||||
}
|
||||
else if (fmt->linerelsize > 0.0)
|
||||
|
@ -2727,7 +2728,7 @@ _layout_format_ascent_descent_adjust(const Evas_Object *eo_obj,
|
|||
descent = descent * fmt->linerelsize;
|
||||
ascent = ascent * fmt->linerelsize;
|
||||
}
|
||||
descent += fmt->linegap;
|
||||
descent += fmt->linegap * obj->cur->scale;
|
||||
descent += ((ascent + descent) * fmt->linerelgap);
|
||||
if (*maxascent < ascent) *maxascent = ascent;
|
||||
if (*maxdescent < descent) *maxdescent = descent;
|
||||
|
|
|
@ -3205,6 +3205,7 @@ START_TEST(evas_textblock_formats)
|
|||
START_TB_TEST();
|
||||
const char *buf = "Th<b>i<font_size=15 wrap=none>s i</font_size=13>s</> a <br/> te<ps/>st<item></>.";
|
||||
const Evas_Object_Textblock_Node_Format *fnode;
|
||||
Evas_Coord w, h, nw, nh;
|
||||
evas_object_textblock_text_markup_set(tb, buf);
|
||||
|
||||
/* Walk from the start */
|
||||
|
@ -3341,7 +3342,6 @@ START_TEST(evas_textblock_formats)
|
|||
|
||||
/* Format text nodes invalidation */
|
||||
{
|
||||
Evas_Coord w, h, nw, nh;
|
||||
evas_object_textblock_text_markup_set(tb, "Test");
|
||||
evas_object_textblock_size_formatted_get(tb, &w, &h);
|
||||
evas_textblock_cursor_paragraph_first(cur);
|
||||
|
@ -3455,9 +3455,33 @@ START_TEST(evas_textblock_formats)
|
|||
evas_object_textblock_text_markup_set(tb, "f<color=#f00>i</color>f");
|
||||
evas_object_textblock_size_formatted_get(tb, NULL, NULL);
|
||||
|
||||
/* Scaling Line size */
|
||||
evas_object_scale_set(tb, 1.0);
|
||||
evas_object_textblock_text_markup_set(tb, "<linesize=100>Line size 100</linesize>");
|
||||
evas_object_resize(tb, 400, 400);
|
||||
evas_object_textblock_size_formatted_get(tb, NULL, &h);
|
||||
ck_assert_int_ge(h, 100);
|
||||
|
||||
evas_object_scale_set(tb, 2.0);
|
||||
evas_object_textblock_size_formatted_get(tb, NULL, &h);
|
||||
ck_assert_int_ge(h, 200);
|
||||
|
||||
/* Scaling Line gap */
|
||||
evas_object_scale_set(tb, 1.0);
|
||||
evas_object_textblock_text_markup_set(tb, "<linegap=100>Line gap 100</linegap>");
|
||||
evas_object_resize(tb, 50, 400);
|
||||
evas_object_textblock_size_formatted_get(tb, NULL, &h);
|
||||
ck_assert_int_ge(h, 100);
|
||||
|
||||
evas_object_scale_set(tb, 2.0);
|
||||
evas_object_textblock_size_formatted_get(tb, NULL, &h);
|
||||
ck_assert_int_ge(h, 200);
|
||||
|
||||
/* Restore scale */
|
||||
evas_object_scale_set(tb, 1.0);
|
||||
|
||||
/* Line gap and multi language */
|
||||
{
|
||||
Evas_Coord h;
|
||||
Evas_Textblock_Style *newst;
|
||||
buf = "This is a test suite for line gap - ഈ ലൈൻ "
|
||||
"വിടവ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ടെസ്റ്റ് ഒരു പരീക്ഷണ വെയര് ";
|
||||
|
|
Loading…
Reference in New Issue