Enlightenment CVS committal

Author  : shorne
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_calc.c edje_embryo.c edje_private.h edje_text.c 
        edje_textblock_styles.c edje_util.c 


Log Message:
Add negative font size handling in text_classes
 * negative size is a multiplier for the origianl size 
 i.e. : -100 = 1.0x;  -120 = 1.2x


===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -3 -r1.97 -r1.98
--- edje_calc.c 5 Apr 2007 15:54:16 -0000       1.97
+++ edje_calc.c 3 May 2007 23:15:09 -0000       1.98
@@ -641,7 +641,7 @@
                  if (tc)
                    {
                       if (tc->font) font = tc->font;
-                      if (tc->size > 0) size = tc->size;
+                      size = _edje_text_size_calc(size, tc);
                    }
               }
          }
@@ -655,7 +655,7 @@
                  if (tc)
                    {
                       if (tc->font) font = tc->font;
-                      if (tc->size > 0) size = tc->size;
+                      size = _edje_text_size_calc(size, tc);
                    }
               }
          }
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_embryo.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- edje_embryo.c       5 Apr 2007 15:54:16 -0000       1.55
+++ edje_embryo.c       3 May 2007 23:15:09 -0000       1.56
@@ -1138,7 +1138,7 @@
    GETSTR(class, params[1]);
    GETSTR(font, params[2]);
    if( !class || !font ) return 0;
-   fsize = (Evas_Font_Size)EMBRYO_CELL_TO_FLOAT(params[3]);
+   fsize = (Evas_Font_Size) EMBRYO_CELL_TO_FLOAT(params[3]);
    edje_object_text_class_set(ed->obj, class, font, fsize);
    return 0;
 }
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -3 -r1.121 -r1.122
--- edje_private.h      5 Apr 2007 15:54:16 -0000       1.121
+++ edje_private.h      3 May 2007 23:15:09 -0000       1.122
@@ -776,9 +776,9 @@
 
 struct _Edje_Text_Class
 {
-   const char   *name;
-   const char   *font;
-   double        size;
+   const char     *name;
+   const char     *font;
+   Evas_Font_Size  size;
 };
 
 struct _Edje_Var_Int
@@ -940,13 +940,14 @@
 void  _edje_emit(Edje *ed, const char *sig, const char *src);
 void  _edje_emit_handle(Edje *ed, const char *sig, const char *src);
 
-void  _edje_text_init(void);
-void  _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
-void  _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep);
-void  _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
-void  _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
-void  _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params 
*params, Edje_Part_Description *chosen_desc);
-    
+void           _edje_text_init(void);
+void           _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
+void           _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep);
+void           _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
+void           _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
+void           _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, 
Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
+Evas_Font_Size _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc);
+
 Edje_Real_Part   *_edje_real_part_get(Edje *ed, const char *part);
 Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
 void              _edje_color_class_member_add(Edje *ed, const char 
*color_class);
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_text.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- edje_text.c 4 Apr 2007 13:25:54 -0000       1.59
+++ edje_text.c 3 May 2007 23:15:09 -0000       1.60
@@ -296,7 +296,7 @@
        if (tc)
          {
             if (tc->font) font = tc->font;
-            if (tc->size > 0) size = tc->size;
+            size = _edje_text_size_calc(size, tc);
          }
      }
    
@@ -584,4 +584,24 @@
      free((char *)text);
    if (font2)
      free(font2);
+}
+
+Evas_Font_Size
+_edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc)
+{
+   int val;
+
+   if (tc->size == 0)
+     {
+       val = size;
+     }
+   else if (tc->size > 0.0)
+     {
+       val = tc->size;
+     }
+   else
+     {
+       val = (size * -tc->size) / 100;
+     }
+   return val;
 }
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_textblock_styles.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- edje_textblock_styles.c     5 Apr 2007 15:54:16 -0000       1.11
+++ edje_textblock_styles.c     3 May 2007 23:15:09 -0000       1.12
@@ -281,12 +281,12 @@
                  buf = _edje_strbuf_append(buf, "font_source=", &buflen, 
&bufalloc);
                  buf = _edje_strbuf_append(buf, fontsource, &buflen, 
&bufalloc);
               } 
-            if (tag->font_size > 0)
+            if (tag->font_size != 0)
               {
                  char font_size[32];
                  
                  if (found)
-                   snprintf(font_size, sizeof(font_size), "%f", tc->size);
+                   snprintf(font_size, sizeof(font_size), "%f", (double) 
_edje_text_size_calc(tag->font_size, tc));
                  else
                    snprintf(font_size, sizeof(font_size), "%f", 
tag->font_size);
                  
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -3 -r1.92 -r1.93
--- edje_util.c 15 Apr 2007 04:24:07 -0000      1.92
+++ edje_util.c 3 May 2007 23:15:09 -0000       1.93
@@ -442,7 +442,6 @@
    Edje_Text_Class *tc;
 
    if (!text_class) return;
-   if (size < 0) size = 0;
    if (!font) font = "";
 
    tc = evas_hash_find(_edje_text_class_hash, text_class);
@@ -577,8 +576,6 @@
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!text_class)) return;
-
-   if (size < 0.0) size = 0.0;
 
    /* for each text_class in the edje */
    for (l = ed->text_classes; l; l = l->next)



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to