* edje: fix fit code when string is empty.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Jul 2010 10:06:02 +0000 (10:06 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Jul 2010 10:06:02 +0000 (10:06 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@50537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_text.c

index 660e32a..e203435 100644 (file)
@@ -384,7 +384,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
    if (ep->text.cache.in_str) eina_stringshare_del(ep->text.cache.in_str);
    ep->text.cache.in_str = eina_stringshare_add(text);
    ep->text.cache.in_size = size;
-   if (chosen_desc->text.fit_x)
+   if (chosen_desc->text.fit_x && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
      {
         if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
        else evas_object_text_font_source_set(ep->object, NULL);
@@ -421,6 +421,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
               {
                  psize = size;
                  size = (size * sw) / tw;
+                 /* fprintf(stderr, "size = %i (%i, %i)\n", size, sw, tw); */
                  if ((psize - size) >= 0) size = psize + 1;
                  if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
                  else evas_object_text_font_source_set(ep->object, NULL);
@@ -432,7 +433,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
               }
          }
      }
-   if (chosen_desc->text.fit_y)
+   if (chosen_desc->text.fit_y && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
      {
        /* if we fit in the x axis, too, size already has a somewhat
         * meaningful value, so don't overwrite it with the starting