Enlightenment CVS committal

Author  : shorne
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_textblock_styles.c 


Log Message:
Edje textblock cleanups fixes
 * Fix edje font order (source, size, font) . This is needed so that evas 
   when parsing the style will only try to load the font once it sees the 
   font name. otherwise, if we load before we know where the source is and
   fontconfig will takeover and load up all of its fallbacks.
 * Remove inheritance. This is covered by evas. This means the text_class
   will only modify style parameters which are already defined in the style.

===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_textblock_styles.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- edje_textblock_styles.c     28 Mar 2006 07:45:54 -0000      1.6
+++ edje_textblock_styles.c     28 Mar 2006 16:36:04 -0000      1.7
@@ -295,17 +295,19 @@
             
             /* Add and Ha`ndle tag parsed data */        
             buf = _edje_strbuf_append(buf, tag->value, &buflen, &bufalloc);
-
-            /* Add font properties */
-            if (tag->font)
+                    
+            if (!strcmp(tag->key, "DEFAULT"))
               {
+                 if (fontset)
+                   {
+                      buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
+                      buf = _edje_strbuf_append(buf, "font_fallbacks=", 
&buflen, &bufalloc);
+                      buf = _edje_strbuf_append(buf, fontset, &buflen, 
&bufalloc);
+                   }
                  buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                 buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
-                 if (found) 
-                   buf = _edje_strbuf_append(buf, tc->font, &buflen, 
&bufalloc);
-                 else
-                   buf = _edje_strbuf_append(buf, tag->font, &buflen, 
&bufalloc);
-              }
+                 buf = _edje_strbuf_append(buf, "font_source=", &buflen, 
&bufalloc);
+                 buf = _edje_strbuf_append(buf, fontsource, &buflen, 
&bufalloc);
+              } 
             if (tag->font_size > 0)
               {
                  char font_size[32];
@@ -319,20 +321,18 @@
                  buf = _edje_strbuf_append(buf, "font_size=", &buflen, 
&bufalloc);
                  buf = _edje_strbuf_append(buf, font_size, &buflen, &bufalloc);
               }
-            found = 0;
-            
-            if (!strcmp(tag->key, "DEFAULT"))
+            /* Add font name last to save evas from multiple loads */
+            if (tag->font)
               {
-                 if (fontset)
-                   {
-                      buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                      buf = _edje_strbuf_append(buf, "font_fallbacks=", 
&buflen, &bufalloc);
-                      buf = _edje_strbuf_append(buf, fontset, &buflen, 
&bufalloc);
-                   }
                  buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                 buf = _edje_strbuf_append(buf, "font_source=", &buflen, 
&bufalloc);
-                 buf = _edje_strbuf_append(buf, fontsource, &buflen, 
&bufalloc);
+                 buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
+                 if (found) 
+                   buf = _edje_strbuf_append(buf, tc->font, &buflen, 
&bufalloc);
+                 else
+                   buf = _edje_strbuf_append(buf, tag->font, &buflen, 
&bufalloc);
               }
+            found = 0;
+            
             buf = _edje_strbuf_append(buf, "'", &buflen, &bufalloc);
          }
        if (fontset) free(fontset);
@@ -410,11 +410,7 @@
        char *buf = NULL;
        int bufalloc = 0;
        int buflen = 0;
-       int def_done = 0;
        char *fontset = NULL, *fontsource = NULL, *ts;
-       const char *default_font = NULL;
-       const char *default_text_class = NULL;
-       double      default_font_size = 0.0; 
        
        stl = l->data;
        if (stl->style) break;
@@ -438,23 +434,6 @@
             
             ts = _edje_format_reparse(edf, tag->value, &(tag));
             
-            /* Handle the returned tag data */
-            if ((!def_done) && (!strcmp(tag->key, "DEFAULT")))
-              {  /* establish base font properties */
-                 default_font_size = tag->font_size;
-                 default_font = tag->font;
-                 default_text_class = tag->text_class;
-              }
-            else
-              {  /* Try to inherit font properties from base style */
-                 if (tag->font_size == 0.0)
-                   tag->font_size = default_font_size;
-                 if (tag->font == NULL && default_font != NULL)
-                   tag->font = evas_stringshare_add(default_font);
-                 if (tag->text_class == NULL && default_text_class != NULL)
-                   tag->text_class = evas_stringshare_add(default_text_class);
-              }
-            
             /* Add and Handle tag parsed data */
             if (ts)
               {
@@ -463,13 +442,18 @@
                  buf = _edje_strbuf_append(buf, tag->value, &buflen, 
&bufalloc);
                  free(ts);
               }
-
-            /* Add font properties */
-            if (tag->font)
+            
+            if (!strcmp(tag->key, "DEFAULT"))
               {
+                 if (fontset)
+                   {
+                      buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
+                      buf = _edje_strbuf_append(buf, "font_fallbacks=", 
&buflen, &bufalloc);
+                      buf = _edje_strbuf_append(buf, fontset, &buflen, 
&bufalloc);
+                   }
                  buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                 buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
-                 buf = _edje_strbuf_append(buf, tag->font, &buflen, &bufalloc);
+                 buf = _edje_strbuf_append(buf, "font_source=", &buflen, 
&bufalloc);
+                 buf = _edje_strbuf_append(buf, fontsource, &buflen, 
&bufalloc);
               }
             if (tag->font_size > 0)
               {
@@ -479,20 +463,13 @@
                  buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
                  buf = _edje_strbuf_append(buf, "font_size=", &buflen, 
&bufalloc);
                  buf = _edje_strbuf_append(buf, font_size, &buflen, &bufalloc);
-              }
-            
-            if ((!def_done) && (!strcmp(tag->key, "DEFAULT")))
+              }        
+            /* Add font name last to save evas from multiple loads */
+            if (tag->font)
               {
-                 if (fontset)
-                   {
-                      buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                      buf = _edje_strbuf_append(buf, "font_fallbacks=", 
&buflen, &bufalloc);
-                      buf = _edje_strbuf_append(buf, fontset, &buflen, 
&bufalloc);
-                   }
                  buf = _edje_strbuf_append(buf, " ", &buflen, &bufalloc);
-                 buf = _edje_strbuf_append(buf, "font_source=", &buflen, 
&bufalloc);
-                 buf = _edje_strbuf_append(buf, fontsource, &buflen, 
&bufalloc);
-                 def_done = 1;
+                 buf = _edje_strbuf_append(buf, "font=", &buflen, &bufalloc);
+                 buf = _edje_strbuf_append(buf, tag->font, &buflen, &bufalloc);
               }
             buf = _edje_strbuf_append(buf, "'", &buflen, &bufalloc);
          }




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to