Prefer Xft font configuration.

SVN revision: 31040
This commit is contained in:
Kim Woelders 2007-07-28 13:58:20 +00:00
parent 4964388015
commit d75ce59159
7 changed files with 41 additions and 38 deletions

View File

@ -5,7 +5,7 @@ config_DATA = \
definitions \
actionclasses.cfg bindings.cfg matches.cfg menus.cfg \
e16keyedit.db \
fonts.cfg-xft_example
fonts.cfg.xft
menudir = $(ENLIGHTENMENT_ROOT)/config/menus
menu_DATA = \

View File

@ -554,6 +554,8 @@ sound.theme =
# When enabled, and e.g. LANG=ja_JP and we are looking for fonts.cfg the search
# order is fonts.cfg.ja_JP, fonts.cfg.ja, fonts.cfg.
theme.localise = 0
# [bool] Prefer fonts.cfg.xft over fonts.cfg
theme.prefer_xft_fonts = 1
# [string] Theme
theme.name = winter
# [string] Colon separated list of directories containing e16 themes

View File

@ -378,6 +378,7 @@ typedef struct
struct
{
char localise;
char prefer_xft_fonts;
char *name;
char *extra_path;
char *ttfont_path;
@ -605,7 +606,7 @@ Window ExtInitWinGet(void);
void ExtInitWinKill(void);
/* fonts.c */
int FontConfigLoad(FILE * fs);
void FontConfigLoad(void);
void FontConfigUnload(void);
const char *FontLookup(const char *name);

View File

@ -344,11 +344,6 @@ ConfigFileRead(FILE * fs)
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 @@ int
ThemeConfigLoad(void)
{
static const char *const config_files[] = {
"fonts.cfg",
"init.cfg",
"textclasses.cfg",
#if ENABLE_COLOR_MODIFIERS
@ -593,6 +587,9 @@ ThemeConfigLoad(void)
Progressbar *p = NULL;
int i;
/* Font mappings */
FontConfigLoad();
Esnprintf(s, sizeof(s), "%s/", Mode.theme.path);
for (i = 0; i < (int)(sizeof(config_files) / sizeof(char *)); i++)

View File

@ -86,48 +86,50 @@ FontLookup(const char *name)
*/
#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
FontConfigUnload(void)
{

View File

@ -500,6 +500,7 @@ static const IpcItem ThemeIpcArray[] = {
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),