Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h config.c fonts.c theme.c 


Log Message:
Prefer Xft font configuration.

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.591
retrieving revision 1.592
diff -u -3 -r1.591 -r1.592
--- E.h 27 Jul 2007 16:59:48 -0000      1.591
+++ E.h 28 Jul 2007 13:58:20 -0000      1.592
@@ -378,6 +378,7 @@
    struct
    {
       char                localise;
+      char                prefer_xft_fonts;
       char               *name;
       char               *extra_path;
       char               *ttfont_path;
@@ -605,7 +606,7 @@
 void                ExtInitWinKill(void);
 
 /* fonts.c */
-int                 FontConfigLoad(FILE * fs);
+void                FontConfigLoad(void);
 void                FontConfigUnload(void);
 const char         *FontLookup(const char *name);
 
===================================================================
RCS file: /cvs/e/e16/e/src/config.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -3 -r1.158 -r1.159
--- config.c    27 Jul 2007 16:59:49 -0000      1.158
+++ config.c    28 Jul 2007 13:58:20 -0000      1.159
@@ -344,11 +344,6 @@
                       if (err)
                          ConfigAlertLoad("Tooltip");
                       break;
-                   case CONFIG_FONTS:
-                      err = FontConfigLoad(fs);
-                      if (err)
-                         ConfigAlertLoad("Font");
-                      break;
                    case CONFIG_TEXT:
                       err = TextclassConfigLoad(fs);
                       if (err)
@@ -573,7 +568,6 @@
 ThemeConfigLoad(void)
 {
    static const char  *const config_files[] = {
-      "fonts.cfg",
       "init.cfg",
       "textclasses.cfg",
 #if ENABLE_COLOR_MODIFIERS
@@ -592,6 +586,9 @@
    char                s[FILEPATH_LEN_MAX];
    Progressbar        *p = NULL;
    int                 i;
+
+   /* Font mappings */
+   FontConfigLoad();
 
    Esnprintf(s, sizeof(s), "%s/", Mode.theme.path);
 
===================================================================
RCS file: /cvs/e/e16/e/src/fonts.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- fonts.c     25 Jul 2007 20:02:57 -0000      1.11
+++ fonts.c     28 Jul 2007 13:58:20 -0000      1.12
@@ -86,46 +86,48 @@
  */
 #include "conf.h"
 
-int
-FontConfigLoad(FILE * fs)
+static int
+_FontConfigLoad(FILE * fs)
 {
    int                 err = 0;
    FontAlias          *fa;
    char                s[FILEPATH_LEN_MAX];
-   char                s1[128];
-   int                 i1, ret;
+   char                s1[128], *p2;
+   int                 i2;
 
    while (GetLine(s, sizeof(s), fs))
      {
-       i1 = -1;
-       ret = sscanf(s, "%d", &i1);
-       if (ret == 1)
-         {
-            switch (i1)
-              {
-              case CONFIG_VERSION:
-              case CONFIG_OPEN:
-                 break;
-              case CONFIG_CLOSE:
-                 goto done;
-              }
-         }
-       else
-         {
-            s1[0] = '\0';
-            i1 = 0;
-            sscanf(s, "%120s %n", s1, &i1);
-            if (i1 <= 1)
-              {
-                 Eprintf("Ignoring line: %s\n", s);
-                 continue;
-              }
-            fa = FontAliasCreate(s1, s + i1);
-         }
+       s1[0] = '\0';
+       i2 = 0;
+       sscanf(s, "%120s %n", s1, &i2);
+       if (i2 <= 0)
+          continue;
+       p2 = s + i2;
+       if (!p2[0])
+          continue;
+       if (strncmp(s, "font-", 5))
+          continue;
+       fa = FontAliasCreate(s1, p2);
      }
 
- done:
    return err;
+}
+
+void
+FontConfigLoad(void)
+{
+#if USE_XFT
+   int                 err;
+
+   if (Conf.theme.prefer_xft_fonts)
+     {
+       err = ConfigFileLoad("fonts.cfg.xft", Mode.theme.path,
+                            _FontConfigLoad, 0);
+       if (!err)
+          return;
+     }
+#endif
+   ConfigFileLoad("fonts.cfg", Mode.theme.path, _FontConfigLoad, 0);
 }
 
 void
===================================================================
RCS file: /cvs/e/e16/e/src/theme.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- theme.c     28 Jul 2007 09:10:43 -0000      1.65
+++ theme.c     28 Jul 2007 13:58:20 -0000      1.66
@@ -500,6 +500,7 @@
 
 static const CfgItem ThemeCfgItems[] = {
    CFG_ITEM_BOOL(Conf.theme, localise, 0),
+   CFG_ITEM_BOOL(Conf.theme, prefer_xft_fonts, 1),
    CFG_ITEM_STR(Conf.theme, name),
    CFG_ITEM_STR(Conf.theme, extra_path),
    CFG_ITEM_STR(Conf.theme, ttfont_path),



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to