Evas textblock: Fixed line size calculation when using multiple fonts.
authorTom Hacohen <tom@stosb.com>
Thu, 25 Apr 2013 14:16:13 +0000 (15:16 +0100)
committerTom Hacohen <tom@stosb.com>
Thu, 25 Apr 2013 14:16:20 +0000 (15:16 +0100)
Thanks to MinSu Seo for reporting.

ChangeLog
NEWS
src/lib/evas/canvas/evas_object_textblock.c

index b72e9e8..99adcd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-25  Tom Hacohen
+
+        * Evas textblock: Fixed line size calculation when using multiple
+       fonts.
+
 2013-04-25  Jihoon Kim
 
         * Edje entry: remove duplicated ecore_imf_context_reset in adjusting the selection
diff --git a/NEWS b/NEWS
index a62f6d3..e721947 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -255,3 +255,4 @@ Fixes:
     * Edje: When selected word exists, selection is cleared and cursor remains on the current entry by additional key input.
     * Ecore-X: Fix selection parser to not overrun buffer read by using longs on 64bit.
     * Evas: Fix recursive proxy image rendering to just render black
+    * Evas textblock: Fixed line size calculation when using multiple fonts.
index 76a9cdb..56d9389 100644 (file)
@@ -3217,6 +3217,17 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
                    &c->maxdescent, &fi->y, &fi->parent.w, &fi->parent.h);
              fi->parent.adv = fi->parent.w;
           }
+        else
+          {
+             Evas_Coord asc = 0, desc = 0;
+             _layout_item_ascent_descent_adjust(c->obj, &asc, &desc,
+                   it, c->position);
+
+             if (asc > c->maxascent)
+                c->maxascent = asc;
+             if (desc > c->maxdescent)
+                c->maxdescent = desc;
+          }
 
 loop_advance:
         it->x = x;
@@ -10112,11 +10123,16 @@ _size_native_calc_line_finalize(const Evas_Object *eo_obj, Eina_List *items,
 
    if (it)
      {
+        Evas_Coord asc = 0, desc = 0;
         /* If there are no text items yet, calc ascent/descent
          * according to the current format. */
-        if (*ascent + *descent == 0)
-           _layout_item_ascent_descent_adjust(eo_obj, ascent, descent,
-                 it, position);
+        _layout_item_ascent_descent_adjust(eo_obj, &asc, &desc,
+              it, position);
+
+        if (asc > *ascent)
+           *ascent = asc;
+        if (desc > *descent)
+           *descent = desc;
 
         /* Add margins. */
         if (it->format)