summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-09-20 16:55:22 +0100
committerTom Hacohen <tom@stosb.com>2013-09-23 14:37:18 +0100
commit2173652b4d0144b6172b74537ad3ad799a1d5468 (patch)
tree4143e6717f4a5a1f02ccecc16884db6bac221852
parentcbde2bef69bebbdce496303365a8c5cd0fa49b79 (diff)
Evas textblock: Fix format based line size calculation.
Format based line size modifiers were not applied.
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c86
1 files changed, 45 insertions, 41 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 99a1ad36de..376647aa75 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2523,10 +2523,8 @@ _layout_format_ascent_descent_adjust(const Evas_Object *eo_obj,
2523 2523
2524 if (fmt->font.font) 2524 if (fmt->font.font)
2525 { 2525 {
2526 // ascent = c->ENFN->font_max_ascent_get(c->ENDT, fmt->font.font); 2526 ascent = *maxascent;
2527 // descent = c->ENFN->font_max_descent_get(c->ENDT, fmt->font.font); 2527 descent = *maxdescent;
2528 ascent = ENFN->font_ascent_get(ENDT, fmt->font.font);
2529 descent = ENFN->font_descent_get(ENDT, fmt->font.font);
2530 if (fmt->linesize > 0) 2528 if (fmt->linesize > 0)
2531 { 2529 {
2532 if ((ascent + descent) < fmt->linesize) 2530 if ((ascent + descent) < fmt->linesize)
@@ -2630,42 +2628,48 @@ _layout_item_max_ascent_descent_calc(const Evas_Object *eo_obj,
2630static void 2628static void
2631_layout_item_ascent_descent_adjust(const Evas_Object *eo_obj, 2629_layout_item_ascent_descent_adjust(const Evas_Object *eo_obj,
2632 Evas_Coord *ascent, Evas_Coord *descent, 2630 Evas_Coord *ascent, Evas_Coord *descent,
2633 Evas_Object_Textblock_Item *it, Textblock_Position position) 2631 Evas_Object_Textblock_Item *it, Evas_Object_Textblock_Format *fmt)
2634{ 2632{
2635 if (!it->format || !it->format->font.font) 2633 void *fi = NULL;
2634 int asc = 0, desc = 0;
2635
2636 if ((!it || !it->format || !it->format->font.font) &&
2637 (!fmt || !fmt->font.font))
2636 { 2638 {
2637 return; 2639 return;
2638 } 2640 }
2639 2641
2640 _layout_format_ascent_descent_adjust(eo_obj, ascent, descent, it->format); 2642 if (it)
2641
2642 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
2643 { 2643 {
2644 { 2644 fmt = it->format;
2645 void *fi = _ITEM_TEXT(it)->text_props.font_instance;
2646 int asc = 0, desc = 0;
2647
2648 if (fi)
2649 {
2650 asc = evas_common_font_instance_ascent_get(fi);
2651 desc = evas_common_font_instance_descent_get(fi);
2652 }
2653 else
2654 {
2655 Evas_Object_Protected_Data *obj =
2656 eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
2657 asc =
2658 ENFN->font_ascent_get(ENDT, it->format->font.font);
2659 desc =
2660 ENFN->font_descent_get(ENDT, it->format->font.font);
2661 }
2662 2645
2663 if (ascent && (asc > *ascent)) 2646 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
2664 *ascent = asc; 2647 {
2665 if (descent && (desc > *descent)) 2648 fi = _ITEM_TEXT(it)->text_props.font_instance;
2666 *descent = desc;
2667 } 2649 }
2668 } 2650 }
2651
2652 if (fi)
2653 {
2654 asc = evas_common_font_instance_ascent_get(fi);
2655 desc = evas_common_font_instance_descent_get(fi);
2656 }
2657 else
2658 {
2659 Evas_Object_Protected_Data *obj =
2660 eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
2661 asc =
2662 ENFN->font_ascent_get(ENDT, fmt->font.font);
2663 desc =
2664 ENFN->font_descent_get(ENDT, fmt->font.font);
2665 }
2666
2667 if (ascent && (asc > *ascent))
2668 *ascent = asc;
2669 if (descent && (desc > *descent))
2670 *descent = desc;
2671
2672 _layout_format_ascent_descent_adjust(eo_obj, ascent, descent, fmt);
2669} 2673}
2670 2674
2671/** 2675/**
@@ -3308,7 +3312,7 @@ _layout_last_line_max_descent_adjust_calc(Ctxt *c, const Evas_Object_Textblock_P
3308 Evas_Coord asc = 0, desc = 0; 3312 Evas_Coord asc = 0, desc = 0;
3309 Evas_Coord maxasc = 0, maxdesc = 0; 3313 Evas_Coord maxasc = 0, maxdesc = 0;
3310 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc, 3314 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc,
3311 it, c->position); 3315 it, it->format);
3312 _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc, 3316 _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc,
3313 it, c->position); 3317 it, c->position);
3314 3318
@@ -3346,8 +3350,8 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
3346 /* If there are no text items yet, calc ascent/descent 3350 /* If there are no text items yet, calc ascent/descent
3347 * according to the current format. */ 3351 * according to the current format. */
3348 if (c->ascent + c->descent == 0) 3352 if (c->ascent + c->descent == 0)
3349 _layout_format_ascent_descent_adjust(c->obj, &c->ascent, 3353 _layout_item_ascent_descent_adjust(c->obj, &c->ascent, &c->descent,
3350 &c->descent, fmt); 3354 NULL, fmt);
3351 3355
3352 /* Adjust all the item sizes according to the final line size, 3356 /* Adjust all the item sizes according to the final line size,
3353 * and update the x positions of all the items of the line. */ 3357 * and update the x positions of all the items of the line. */
@@ -3366,7 +3370,7 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
3366 Evas_Coord asc = 0, desc = 0; 3370 Evas_Coord asc = 0, desc = 0;
3367 Evas_Coord maxasc = 0, maxdesc = 0; 3371 Evas_Coord maxasc = 0, maxdesc = 0;
3368 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc, 3372 _layout_item_ascent_descent_adjust(c->obj, &asc, &desc,
3369 it, c->position); 3373 it, it->format);
3370 _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc, 3374 _layout_item_max_ascent_descent_calc(c->obj, &maxasc, &maxdesc,
3371 it, c->position); 3375 it, c->position);
3372 3376
@@ -4545,7 +4549,7 @@ _layout_par(Ctxt *c)
4545 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) 4549 if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
4546 { 4550 {
4547 _layout_item_ascent_descent_adjust(c->obj, &c->ascent, 4551 _layout_item_ascent_descent_adjust(c->obj, &c->ascent,
4548 &c->descent, it, c->position); 4552 &c->descent, it, it->format);
4549 } 4553 }
4550 else 4554 else
4551 { 4555 {
@@ -4558,7 +4562,7 @@ _layout_par(Ctxt *c)
4558 * according to the current format. */ 4562 * according to the current format. */
4559 if (c->ascent + c->descent == 0) 4563 if (c->ascent + c->descent == 0)
4560 _layout_item_ascent_descent_adjust(c->obj, &c->ascent, 4564 _layout_item_ascent_descent_adjust(c->obj, &c->ascent,
4561 &c->descent, it, c->position); 4565 &c->descent, it, it->format);
4562 4566
4563 _layout_calculate_format_item_size(c->obj, fi, &c->ascent, 4567 _layout_calculate_format_item_size(c->obj, fi, &c->ascent,
4564 &c->descent, &fi->y, &fi->parent.w, &fi->parent.h); 4568 &c->descent, &fi->y, &fi->parent.w, &fi->parent.h);
@@ -10323,7 +10327,7 @@ _size_native_calc_line_finalize(const Evas_Object *eo_obj, Eina_List *items,
10323 /* If there are no text items yet, calc ascent/descent 10327 /* If there are no text items yet, calc ascent/descent
10324 * according to the current format. */ 10328 * according to the current format. */
10325 _layout_item_ascent_descent_adjust(eo_obj, &asc, &desc, 10329 _layout_item_ascent_descent_adjust(eo_obj, &asc, &desc,
10326 it, position); 10330 it, it->format);
10327 10331
10328 if (asc > *ascent) 10332 if (asc > *ascent)
10329 *ascent = asc; 10333 *ascent = asc;
@@ -10352,7 +10356,7 @@ _size_native_calc_line_finalize(const Evas_Object *eo_obj, Eina_List *items,
10352 else 10356 else
10353 { 10357 {
10354 _layout_item_ascent_descent_adjust(eo_obj, ascent, descent, 10358 _layout_item_ascent_descent_adjust(eo_obj, ascent, descent,
10355 it, position); 10359 it, it->format);
10356 } 10360 }
10357 10361
10358loop_advance: 10362loop_advance:
@@ -10403,7 +10407,7 @@ _size_native_calc_paragraph_size(const Evas_Object *eo_obj,
10403 * according to the current format. */ 10407 * according to the current format. */
10404 if (it && (ascent + descent == 0)) 10408 if (it && (ascent + descent == 0))
10405 _layout_item_ascent_descent_adjust(eo_obj, &ascent, 10409 _layout_item_ascent_descent_adjust(eo_obj, &ascent,
10406 &descent, it, *position); 10410 &descent, it, it->format);
10407 10411
10408 _layout_calculate_format_item_size(eo_obj, fi, &ascent, 10412 _layout_calculate_format_item_size(eo_obj, fi, &ascent,
10409 &descent, &fy, &fw, &fh); 10413 &descent, &fy, &fw, &fh);
@@ -10412,7 +10416,7 @@ _size_native_calc_paragraph_size(const Evas_Object *eo_obj,
10412 else 10416 else
10413 { 10417 {
10414 _layout_item_ascent_descent_adjust(eo_obj, &ascent, 10418 _layout_item_ascent_descent_adjust(eo_obj, &ascent,
10415 &descent, it, *position); 10419 &descent, it, it->format);
10416 } 10420 }
10417 } 10421 }
10418 10422