tasn pushed a commit to branch evas-1.7.

http://git.enlightenment.org/legacy/evas.git/commit/?id=50b1a88f857c8c038c43a1d7d6eb4fbf69121333

commit 50b1a88f857c8c038c43a1d7d6eb4fbf69121333
Author: Tom Hacohen <t...@stosb.com>
Date:   Mon Sep 23 15:03:45 2013 +0100

    Evas textblock: Fixed max descent calculation.
    
    This is not a direct backport, but an alternative fix to the same thing
    that was fixed in 1.8.
    
    This is kind of in continutation of: 
4f995ed37ca59f083d10bb4cd4bd5e283e825e51
---
 src/lib/canvas/evas_object_textblock.c | 78 +++++++++++++++++++++++++---------
 1 file changed, 58 insertions(+), 20 deletions(-)

diff --git a/src/lib/canvas/evas_object_textblock.c 
b/src/lib/canvas/evas_object_textblock.c
index 2ecbf5c..52adaf7 100644
--- a/src/lib/canvas/evas_object_textblock.c
+++ b/src/lib/canvas/evas_object_textblock.c
@@ -2585,25 +2585,6 @@ _layout_item_ascent_descent_adjust(const Evas_Object 
*obj,
              if (maxascent && (asc > *maxascent))
                 *maxascent = asc;
           }
-
-        if ((position == TEXTBLOCK_POSITION_END) ||
-              (position == TEXTBLOCK_POSITION_SINGLE))
-          {
-             int desc = 0;
-
-             if (fi)
-               {
-                  desc = evas_common_font_instance_max_descent_get(fi);
-               }
-             else
-               {
-                  desc =
-                     ENFN->font_max_descent_get(ENDT, it->format->font.font);
-               }
-
-             if (maxdescent && (desc > *maxdescent))
-                *maxdescent = desc;
-          }
      }
 }
 
@@ -3225,6 +3206,59 @@ _layout_calculate_format_item_size(const Evas_Object 
*obj,
    *_h = h;
 }
 
+static Evas_Coord
+_layout_last_line_max_descent_adjust_calc(Ctxt *c, const 
Evas_Object_Textblock_Paragraph *last_vis_par)
+{
+   if (last_vis_par->lines)
+     {
+        Evas_Coord maxdescent = 0, descent = 0;
+        Evas_Object_Textblock_Line *ln = (Evas_Object_Textblock_Line *)
+           EINA_INLIST_GET(last_vis_par->lines)->last;
+        Evas_Object_Textblock_Item *it;
+
+        EINA_INLIST_FOREACH(ln->items, it)
+          {
+             if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
+               {
+                  Evas_Coord asc = 0, desc = 0;
+                  _layout_item_ascent_descent_adjust(c->obj, &asc, &desc,
+                        it, c->position);
+
+                  if ((c->position == TEXTBLOCK_POSITION_END) ||
+                        (c->position == TEXTBLOCK_POSITION_SINGLE))
+                    {
+                       Evas_Coord mdesc = 0;
+                       void *fi = _ITEM_TEXT(it)->text_props.font_instance;
+
+                       if (fi)
+                         {
+                            mdesc = 
evas_common_font_instance_max_descent_get(fi);
+                         }
+                       else
+                         {
+                            Evas_Object *obj = c->obj;
+                            mdesc =
+                               ENFN->font_max_descent_get(ENDT, 
it->format->font.font);
+                         }
+
+                       if (mdesc > maxdescent)
+                          maxdescent = mdesc;
+                    }
+
+                  if (desc > descent)
+                     descent = desc;
+               }
+          }
+
+        if (maxdescent > descent)
+          {
+             return maxdescent - descent;
+          }
+     }
+
+   return 0;
+}
+
 /**
  * @internal
  * Order the items in the line, update it's properties and update it's
@@ -5064,7 +5098,11 @@ _layout(const Evas_Object *obj, int w, int h, int 
*w_ret, int *h_ret)
             EINA_INLIST_GET(c->paragraphs)->last;
 
       if (last_vis_par)
-         c->hmax = last_vis_par->y + last_vis_par->h;
+        {
+           c->hmax = last_vis_par->y + last_vis_par->h +
+              _layout_last_line_max_descent_adjust_calc(c, last_vis_par);
+        }
+
    }
 
    /* Clean the rest of the format stack */

-- 


Reply via email to