fix: Do not require custom font list

This commit is contained in:
Michael Carlberg 2016-11-18 17:49:47 +01:00
parent 1b5979ba10
commit 2140e11369

View File

@ -452,7 +452,11 @@ void bar::refresh_window() {
void bar::load_fonts() { void bar::load_fonts() {
auto fonts_loaded = false; auto fonts_loaded = false;
auto fontindex = 0; auto fontindex = 0;
auto fonts = m_conf.get_list<string>("font"); auto fonts = m_conf.get_list<string>(m_conf.bar_section(), "font", {});
if (fonts.empty()) {
m_log.warn("No fonts specified, using fallback font \"fixed\"");
}
for (auto f : fonts) { for (auto f : fonts) {
fontindex++; fontindex++;
@ -469,10 +473,11 @@ void bar::load_fonts() {
m_log.warn("Unable to load font '%s'", fd[0]); m_log.warn("Unable to load font '%s'", fd[0]);
} }
if (!fonts_loaded) { if (!fonts_loaded && !fonts.empty()) {
m_log.warn("Loading fallback font"); m_log.warn("Unable to load fonts, using fallback font \"fixed\"");
}
if (!m_fontmanager->load("fixed")) if (!fonts_loaded && !m_fontmanager->load("fixed")) {
throw application_error("Unable to load fonts"); throw application_error("Unable to load fonts");
} }