evas textblock: use main font's ascent/descent as minimum value
authorYoungbok Shin <youngb.shin@samsung.com>
Tue, 26 Sep 2017 11:33:10 +0000 (14:33 +0300)
committerDaniel Hirt <hirt.danny@gmail.com>
Tue, 26 Sep 2017 11:33:11 +0000 (14:33 +0300)
Summary:
The patch will adjust ascent/descent with considering main font's ascent/descent
as minimum value. Actually, this patch re-apply D5217 with resolving linegap issue
on the _layout_format_ascent_descent_adjust() function.
@fix

Test Plan: Put a text which will load smaller font. And put a text which will load primary font.

Reviewers: raster, cedric, herdsman, jpeg

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

src/lib/evas/canvas/evas_object_textblock.c

index 60d2ff0..eabc0b1 100644 (file)
@@ -3032,16 +3032,19 @@ _layout_item_ascent_descent_adjust(Evas_Object_Protected_Data *obj,
           }
      }
 
-   if (fi)
+   if (fmt)
      {
-        asc = evas_common_font_instance_ascent_get(fi);
-        desc = evas_common_font_instance_descent_get(fi);
+        asc = ENFN->font_ascent_get(ENC, fmt->font.font);
+        desc = ENFN->font_descent_get(ENC, fmt->font.font);
      }
 
-   else if (fmt)
+   if (fi)
      {
-        asc = ENFN->font_ascent_get(ENC, fmt->font.font);
-        desc = ENFN->font_descent_get(ENC, fmt->font.font);
+        int fi_asc = evas_common_font_instance_ascent_get(fi);
+        int fi_desc = evas_common_font_instance_descent_get(fi);
+
+        if (fi_asc > asc) asc = fi_asc;
+        if (fi_desc > desc) desc = fi_desc;
      }
 
    if (fmt) _layout_format_ascent_descent_adjust(obj, &asc, &desc, fmt);