diff --git a/config/fonts.pango.cfg b/config/fonts.pango.cfg index a33c4cbf..8b1dac12 100644 --- a/config/fonts.pango.cfg +++ b/config/fonts.pango.cfg @@ -1,7 +1,4 @@ -/* Pango font example */ -#include -__E_CFG_VERSION 1 -__FONTS __BGN +# Default Pango font configuration font-default "pango:sans bold 8" @@ -29,5 +26,3 @@ font-menu "pango:sans 8" font-pager "pango:sans bold 8" font-tooltip "pango:sans bold 8" - -__END diff --git a/config/fonts.xft.cfg b/config/fonts.xft.cfg index 1eaee7dd..7e3ae03b 100644 --- a/config/fonts.xft.cfg +++ b/config/fonts.xft.cfg @@ -1,7 +1,4 @@ -/* Xft font example */ -#include -__E_CFG_VERSION 1 -__FONTS __BGN +# Default Xft font configuration font-default "xft:sans-8:bold" @@ -29,5 +26,3 @@ font-menu "xft:sans-8" font-pager "xft:sans-8:bold" font-tooltip "xft:sans-8:bold" - -__END diff --git a/src/fonts.c b/src/fonts.c index 9ef3265d..a4b75fb9 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -22,6 +22,7 @@ */ #include "E.h" #include "e16-ecore_list.h" +#include "parse.h" typedef struct { char *name; @@ -89,23 +90,27 @@ static int _FontConfigLoad(FILE * fs) { int err = 0; - char s[FILEPATH_LEN_MAX]; - char s1[128], *p2; - int i2; + char s[FILEPATH_LEN_MAX], *ss, *name, *font; + int len; - while (GetLine(s, sizeof(s), fs)) + for (;;) { - s1[0] = '\0'; - i2 = 0; - sscanf(s, "%120s %n", s1, &i2); - if (i2 <= 0) + ss = fgets(s, sizeof(s), fs); + if (!ss) + break; + + len = strcspn(s, "#\r\n"); + if (len <= 0) continue; - p2 = s + i2; - if (!p2[0]) + + name = font = NULL; + parse(s, "%S%S", &name, &font); + if (!name || !font) continue; - if (strncmp(s, "font-", 5)) + + if (strncmp(name, "font-", 5)) continue; - FontAliasCreate(s1, p2); + FontAliasCreate(name, font); } return err;