summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-22 19:42:36 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-08-22 20:14:59 +0900
commit1c82a88d6e7f10ad74340a95535561204e89ad96 (patch)
tree313b51d3299a08a21b03c65062e6a3109003db33 /src
parentf5d9fb132007055590a17ed645f65cc88f39b0ec (diff)
evas text - deal with possible null text in layout
fix CID 1039408
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_text.c74
1 files changed, 40 insertions, 34 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 5ef4bdb853..37a4c563cf 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -700,10 +700,14 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
700 o->bidi_dir = EVAS_BIDI_DIRECTION_NEUTRAL; 700 o->bidi_dir = EVAS_BIDI_DIRECTION_NEUTRAL;
701 701
702#ifdef BIDI_SUPPORT 702#ifdef BIDI_SUPPORT
703 if (o->bidi_delimiters) 703 if (text)
704 segment_idxs = evas_bidi_segment_idxs_get(text, o->bidi_delimiters); 704 {
705 if (o->bidi_delimiters)
706 segment_idxs = evas_bidi_segment_idxs_get(text, o->bidi_delimiters);
707 }
705 evas_bidi_paragraph_props_unref(o->bidi_par_props); 708 evas_bidi_paragraph_props_unref(o->bidi_par_props);
706 o->bidi_par_props = evas_bidi_paragraph_props_get(text, len, segment_idxs); 709 if (text)
710 o->bidi_par_props = evas_bidi_paragraph_props_get(text, len, segment_idxs);
707 711
708 if (o->bidi_par_props) 712 if (o->bidi_par_props)
709 o->bidi_dir = EVAS_BIDI_PAR_TYPE_TO_DIRECTION(o->bidi_par_props->direction); 713 o->bidi_dir = EVAS_BIDI_PAR_TYPE_TO_DIRECTION(o->bidi_par_props->direction);
@@ -713,44 +717,46 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
713#endif 717#endif
714 visual_pos = pos = 0; 718 visual_pos = pos = 0;
715 719
716 while (len > 0) 720 if (text)
717 { 721 {
718 Evas_Font_Instance *script_fi = NULL; 722 while (len > 0)
719 int script_len = len, tmp_cut;
720 Evas_Script_Type script;
721 tmp_cut = evas_common_language_script_end_of_run_get(
722 text + pos,
723 o->bidi_par_props,
724 pos, len);
725 if (tmp_cut > 0)
726 script_len = tmp_cut;
727
728 script = evas_common_language_script_type_get(text + pos, script_len);
729
730 while (script_len > 0)
731 { 723 {
732 const Evas_Object_Text_Item *it; 724 Evas_Font_Instance *script_fi = NULL;
733 Evas_Font_Instance *cur_fi = NULL; 725 int script_len = len, tmp_cut;
734 int run_len = script_len; 726 Evas_Script_Type script;
735 if (o->font) 727 tmp_cut = evas_common_language_script_end_of_run_get
728 (text + pos,
729 o->bidi_par_props,
730 pos, len);
731 if (tmp_cut > 0) script_len = tmp_cut;
732
733 script = evas_common_language_script_type_get(text + pos, script_len);
734
735 while (script_len > 0)
736 { 736 {
737 run_len = ENFN->font_run_end_get(ENDT, 737 const Evas_Object_Text_Item *it;
738 o->font, &script_fi, &cur_fi, 738 Evas_Font_Instance *cur_fi = NULL;
739 script, text + pos, script_len); 739 int run_len = script_len;
740 } 740 if (o->font)
741 {
742 run_len = ENFN->font_run_end_get
743 (ENDT, o->font, &script_fi, &cur_fi,
744 script, text + pos, script_len);
745 }
741#ifdef BIDI_SUPPORT 746#ifdef BIDI_SUPPORT
742 visual_pos = evas_bidi_position_logical_to_visual( 747 visual_pos = evas_bidi_position_logical_to_visual
743 v_to_l, par_len, pos); 748 (v_to_l, par_len, pos);
744#else 749#else
745 visual_pos = pos; 750 visual_pos = pos;
746#endif 751#endif
747 it = _evas_object_text_item_new(obj, o, cur_fi, text, script, 752 it = _evas_object_text_item_new(obj, o, cur_fi, text, script,
748 pos, visual_pos, run_len); 753 pos, visual_pos, run_len);
749 754
750 advance += it->adv; 755 advance += it->adv;
751 pos += run_len; 756 pos += run_len;
752 script_len -= run_len; 757 script_len -= run_len;
753 len -= run_len; 758 len -= run_len;
759 }
754 } 760 }
755 } 761 }
756 o->last_computed.advance_without_ellipsis = advance; 762 o->last_computed.advance_without_ellipsis = advance;