diff --git a/config/Makefile.am b/config/Makefile.am index a356a46a..1c99858f 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -5,7 +5,7 @@ config_DATA = \ definitions \ actionclasses.cfg bindings.cfg matches.cfg menus.cfg \ e16keyedit.db \ - fonts.cfg.xft fonts.cfg.pango + fonts.xft.cfg fonts.pango.cfg menudir = $(pkgdatadir)/config/menus menu_DATA = \ diff --git a/config/fonts.cfg.pango b/config/fonts.pango.cfg similarity index 100% rename from config/fonts.cfg.pango rename to config/fonts.pango.cfg diff --git a/config/fonts.cfg.xft b/config/fonts.xft.cfg similarity index 100% rename from config/fonts.cfg.xft rename to config/fonts.xft.cfg diff --git a/src/E.h b/src/E.h index 74ac19f4..3fc714ed 100644 --- a/src/E.h +++ b/src/E.h @@ -261,6 +261,7 @@ typedef struct { char animate; } startup; struct { + char use_theme_font_cfg; char use_alt_font_cfg; char *name; char *extra_path; diff --git a/src/fonts.c b/src/fonts.c index d018a652..96a9e342 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -112,21 +112,45 @@ _FontConfigLoad(FILE * fs) return err; } +static int +_FontConfigLoad1(const char *cfg, int look_in_theme_too) +{ + const char *path; + + path = (look_in_theme_too) ? Mode.theme.path : NULL; + + return ConfigFileLoad(cfg, path, _FontConfigLoad, 0); +} + void FontConfigLoad(void) { - int err; - - if (Conf.theme.use_alt_font_cfg) + /* First check explicitly specified configuration (not in theme dir) */ + if (Conf.theme.use_alt_font_cfg && Conf.theme.font_cfg) { - if (!Conf.theme.font_cfg) - Conf.theme.font_cfg = Estrdup("fonts.cfg.xft"); - err = ConfigFileLoad(Conf.theme.font_cfg, Mode.theme.path, - _FontConfigLoad, 0); - if (!err) + if (!_FontConfigLoad1(Conf.theme.font_cfg, 0)) return; } - ConfigFileLoad("fonts.cfg", Mode.theme.path, _FontConfigLoad, 0); + + /* If using theme font is specified look for that */ + if (Conf.theme.use_theme_font_cfg) + { + if (!_FontConfigLoad1("fonts.theme.cfg", 1)) + return; + } + + /* Look in user config dir (not in theme dir) */ + _FontConfigLoad1("fonts.cfg", 0); + +#if USE_PANGO + if (!_FontConfigLoad1("fonts.pango.cfg", 1)) + return; +#endif +#if USE_XFT + if (!_FontConfigLoad1("fonts.xft.cfg", 1)) + return; +#endif + _FontConfigLoad1("fonts.cfg", 1); } void diff --git a/src/theme.c b/src/theme.c index 92dedee0..91350d62 100644 --- a/src/theme.c +++ b/src/theme.c @@ -414,7 +414,8 @@ static const IpcItem ThemeIpcArray[] = { static const CfgItem ThemeCfgItems[] = { CFG_ITEM_STR(Conf.theme, name), CFG_ITEM_STR(Conf.theme, extra_path), - CFG_ITEM_BOOL(Conf.theme, use_alt_font_cfg, 1), + CFG_ITEM_BOOL(Conf.theme, use_theme_font_cfg, 0), + CFG_ITEM_BOOL(Conf.theme, use_alt_font_cfg, 0), CFG_ITEM_STR(Conf.theme, font_cfg), }; #define N_CFG_ITEMS (sizeof(ThemeCfgItems)/sizeof(CfgItem))