woohyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=06e9af1b0cee7194bf6dc848b195caed1295847e

commit 06e9af1b0cee7194bf6dc848b195caed1295847e
Author: Ali Alzyod <[email protected]>
Date:   Thu Mar 12 20:07:12 2020 +0900

    edje_textblock: style font size override size_range max
    
    Summary: style font size (also text_class) will change size_range max 
value, regardless of what user specifed in textblock description
    
    Reviewers: woohyun
    
    Reviewed By: woohyun
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D11493
---
 src/lib/edje/edje_textblock.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/edje_textblock.c b/src/lib/edje/edje_textblock.c
index d0c5c6d30d..fe3ec439fb 100644
--- a/src/lib/edje/edje_textblock.c
+++ b/src/lib/edje/edje_textblock.c
@@ -493,6 +493,20 @@ _edje_part_textblock_style_text_set(Edje *ed,
    return EINA_FALSE;
 }
 
+static char*
+strrstr(const char* haystack, const char* violate)
+{
+   char *s_ret = NULL;
+   char *tmp = NULL;
+   const char *_haystack = haystack;
+   size_t len = strlen(violate);
+   while((tmp = strstr(_haystack, violate))){
+     s_ret = tmp;
+     _haystack = tmp + len;
+   }
+   return s_ret;
+}
+
 void
 _edje_part_recalc_single_textblock(FLOAT_T sc,
                                    Edje *ed,
@@ -522,11 +536,21 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
                   size_t size_array_len = 0;
                   Eina_List *l;
                   unsigned int *value;
+                  Evas_Textblock_Style *st = _edje_textblock_style_get(ed, 
chosen_desc->text.style.str);
+                  const char *text_style = evas_textblock_style_get(st);
+                  char *s_font_size = (text_style) ? 
strrstr(text_style,"font_size=") : NULL;
+                  if (s_font_size)
+                    {
+                      int font_size = strtol(&s_font_size[10], NULL, 10);
+                      chosen_desc->text.size_range_max = font_size;
+                      if (chosen_desc->text.size_range_min > 
chosen_desc->text.size_range_max)
+                        chosen_desc->text.size_range_min = 
chosen_desc->text.size_range_max;
+                    }
                   EINA_LIST_FOREACH(chosen_desc->text.fit_size_array, l, value)
                     {
                        size_array[size_array_len++] = *value;
                     }
-                 unsigned int mode = TEXTBLOCK_FIT_MODE_NONE;
+                  unsigned int mode = TEXTBLOCK_FIT_MODE_NONE;
 
                   if (chosen_desc->text.fit_x)
                     mode |= TEXTBLOCK_FIT_MODE_WIDTH;

-- 


Reply via email to