Evas textblock: Fixed issue with line height when breakingon format.
authorStefan Schmidt <stefan@datenfreihafen.org>
Mon, 14 Jan 2013 14:18:10 +0000 (14:18 +0000)
committerStefan Schmidt <stefan@datenfreihafen.org>
Mon, 14 Jan 2013 14:18:10 +0000 (14:18 +0000)
All kudos to Tom for this one.

SVN revision: 82763

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

index 85be617..ce842b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-14  Tom Hacohen (TAsn)
+
+       * Evas textblock: Fixed issue with line height when breaking on a
+       format.
+
 2013-01-14  Cedric Bail
 
        * Fix bug in eio_file_map_new container set.
diff --git a/NEWS b/NEWS
index 962d2c2..4658915 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -111,3 +111,4 @@ Fixes:
     * Evas texblock: Fixed a bug with breaking after format items.
     * Fix endianess issue in Eet_Image.
     * Fix bug in eio_file_map_new container set.
+    * Evas textblock: Fixed issue with line height when breaking on a format.
index 2249111..8f14453 100644 (file)
@@ -4300,6 +4300,7 @@ _layout_par(Ctxt *c)
     * inside the list and then walk them on the next iteration. */
    for (i = c->par->logical_items ; i ; )
      {
+        Evas_Coord prevdescent = 0, prevascent = 0;
         int adv_line = 0;
         int redo_item = 0;
         it = _ITEM(eina_list_data_get(i));
@@ -4321,6 +4322,8 @@ _layout_par(Ctxt *c)
              Evas_Object_Textblock_Format_Item *fi = _ITEM_FORMAT(it);
              if (fi->formatme)
                {
+                  prevdescent = c->maxdescent;
+                  prevascent = c->maxascent;
                   /* If there are no text items yet, calc ascent/descent
                    * according to the current format. */
                   if (c->maxascent + c->maxdescent == 0)
@@ -4474,6 +4477,12 @@ _layout_par(Ctxt *c)
                   else if (wrap == 0)
                     {
                        /* Should wrap before the item */
+
+                       /* We didn't end up using the item, so revert the ascent
+                        * and descent changes. */
+                       c->maxdescent = prevdescent;
+                       c->maxascent = prevascent;
+
                        adv_line = 0;
                        redo_item = 1;
                        _layout_line_advance(c, it->format);