summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/evas/canvas/evas_object_text.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index cf31ed9fd9..a7e07679c2 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -689,6 +689,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
689 Evas_Coord advance = 0; 689 Evas_Coord advance = 0;
690 size_t pos, visual_pos; 690 size_t pos, visual_pos;
691 int len = eina_unicode_strlen(text); 691 int len = eina_unicode_strlen(text);
692 int l = 0, r = 0;
692#ifdef BIDI_SUPPORT 693#ifdef BIDI_SUPPORT
693 int par_len = len; 694 int par_len = len;
694 int *segment_idxs = NULL; 695 int *segment_idxs = NULL;
@@ -767,12 +768,16 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
767 } 768 }
768 } 769 }
769 770
771 evas_text_style_pad_get(o->cur.style, &l, &r, NULL, NULL);
772
770 /* Handle ellipsis */ 773 /* Handle ellipsis */
771 if (pos && (o->cur.ellipsis >= 0.0) && (advance > obj->cur->geometry.w) && (obj->cur->geometry.w > 0)) 774 if (pos && (o->cur.ellipsis >= 0.0) && (advance + l + r > obj->cur->geometry.w) && (obj->cur->geometry.w > 0))
772 { 775 {
773 Evas_Coord ellip_frame = obj->cur->geometry.w; 776 Evas_Coord ellip_frame = obj->cur->geometry.w;
774 Evas_Object_Text_Item *start_ellip_it = NULL, *end_ellip_it = NULL; 777 Evas_Object_Text_Item *start_ellip_it = NULL, *end_ellip_it = NULL;
775 778
779 o->last_computed.ellipsis = EINA_TRUE;
780
776 /* Account of the ellipsis item width. As long as ellipsis != 0 781 /* Account of the ellipsis item width. As long as ellipsis != 0
777 * we have a left ellipsis. And the same with 1 and right. */ 782 * we have a left ellipsis. And the same with 1 and right. */
778 if (o->cur.ellipsis != 0) 783 if (o->cur.ellipsis != 0)
@@ -815,7 +820,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
815 Evas_Object_Text_Item *itr = o->items; 820 Evas_Object_Text_Item *itr = o->items;
816 advance = 0; 821 advance = 0;
817 822
818 while (itr && (advance + itr->adv < ellipsis_coord)) 823 while (itr && (advance + l + r + itr->adv < ellipsis_coord))
819 { 824 {
820 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next; 825 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next;
821 if ((itr != start_ellip_it) && (itr != end_ellip_it)) 826 if ((itr != start_ellip_it) && (itr != end_ellip_it))
@@ -830,7 +835,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
830 int cut = 1 + ENFN->font_last_up_to_pos(ENDT, 835 int cut = 1 + ENFN->font_last_up_to_pos(ENDT,
831 o->font, 836 o->font,
832 &itr->text_props, 837 &itr->text_props,
833 ellipsis_coord - advance, 838 ellipsis_coord - (advance + l + r),
834 0); 839 0);
835 if (cut > 0) 840 if (cut > 0)
836 { 841 {
@@ -841,7 +846,6 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
841 { 846 {
842 _evas_object_text_item_del(o, itr); 847 _evas_object_text_item_del(o, itr);
843 } 848 }
844 o->last_computed.ellipsis = EINA_TRUE;
845 } 849 }
846 } 850 }
847 851
@@ -858,7 +862,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
858 { 862 {
859 if (itr != end_ellip_it) /* was start_ellip_it */ 863 if (itr != end_ellip_it) /* was start_ellip_it */
860 { 864 {
861 if (advance + itr->adv >= ellip_frame) 865 if (advance + l + r + itr->adv >= ellip_frame)
862 { 866 {
863 break; 867 break;
864 } 868 }
@@ -875,7 +879,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
875 int cut = ENFN->font_last_up_to_pos(ENDT, 879 int cut = ENFN->font_last_up_to_pos(ENDT,
876 o->font, 880 o->font,
877 &itr->text_props, 881 &itr->text_props,
878 ellip_frame - advance, 882 ellip_frame - (advance + l + r),
879 0); 883 0);
880 if (cut >= 0) 884 if (cut >= 0)
881 { 885 {
@@ -885,7 +889,6 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
885 { 889 {
886 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next; 890 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
887 } 891 }
888 o->last_computed.ellipsis = EINA_TRUE;
889 } 892 }
890 893
891 /* Remove the rest of the items */ 894 /* Remove the rest of the items */
@@ -2475,7 +2478,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
2475 { 2478 {
2476 int min; 2479 int min;
2477 2480
2478 min = w + l + r < obj->cur->geometry.w ? w + l + r : obj->cur->geometry.w; 2481 min = w + l + r < obj->cur->geometry.w || obj->cur->geometry.w == 0 ? w + l + r : obj->cur->geometry.w;
2479 eo_do_super(eo_obj, MY_CLASS, 2482 eo_do_super(eo_obj, MY_CLASS,
2480 evas_obj_size_set(min, h + t + b)); 2483 evas_obj_size_set(min, h + t + b));
2481 } 2484 }