From 455d8790b9d80430f5ea6a96dd213fbc3c03492f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 25 Apr 2013 15:16:13 +0100 Subject: [PATCH] Evas textblock: Fixed line size calculation when using multiple fonts. Thanks to MinSu Seo for reporting. --- ChangeLog | 5 +++++ NEWS | 1 + src/lib/evas/canvas/evas_object_textblock.c | 22 ++++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b72e9e8d48..99adcd74e8 100644 --- 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 a62f6d3dac..e721947715 100644 --- 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. diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 76a9cdbcb7..56d9389937 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -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)