evas - textblock ... fix valign handling to actually work as documented
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 8 Feb 2014 13:54:56 +0000 (22:54 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 8 Feb 2014 13:54:56 +0000 (22:54 +0900)
valign handling was really broken. this fixes it to pretty much work
again. ie 0.0 == top, 0.5 == centered, 1.0 == bottom align and -1.0
== baseline. only baseline worked before.

src/lib/evas/canvas/evas_object_textblock.c

index f62370d..c717ac4 100644 (file)
@@ -10743,7 +10743,15 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
                   yoff = ln->baseline; \
                   if (itr->format->valign != -1.0) \
                     { \
-                       yoff += itr->format->valign * (ln->h - itr->h); \
+                       if (itr->type == EVAS_TEXTBLOCK_ITEM_TEXT) \
+                         { \
+                            Evas_Object_Textblock_Text_Item *titr = \
+                              (Evas_Object_Textblock_Text_Item *)itr; \
+                            yoff = \
+                              evas_common_font_instance_max_ascent_get(titr->text_props.font_instance) +\
+                              (itr->format->valign * (ln->h - itr->h)); \
+                         } \
+                       else yoff = itr->format->valign * (ln->h - itr->h); \
                     } \
                   itr->yoff = yoff;             \
                   if (clip) \