From 2140e11369a3002bd8c0df347308b6c793aa6f49 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Fri, 18 Nov 2016 17:49:47 +0100 Subject: [PATCH] fix: Do not require custom font list --- src/components/bar.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/bar.cpp b/src/components/bar.cpp index cb3e14df..0b2a4483 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -452,7 +452,11 @@ void bar::refresh_window() { void bar::load_fonts() { auto fonts_loaded = false; auto fontindex = 0; - auto fonts = m_conf.get_list("font"); + auto fonts = m_conf.get_list(m_conf.bar_section(), "font", {}); + + if (fonts.empty()) { + m_log.warn("No fonts specified, using fallback font \"fixed\""); + } for (auto f : fonts) { fontindex++; @@ -469,11 +473,12 @@ void bar::load_fonts() { m_log.warn("Unable to load font '%s'", fd[0]); } - if (!fonts_loaded) { - m_log.warn("Loading fallback font"); + if (!fonts_loaded && !fonts.empty()) { + m_log.warn("Unable to load fonts, using fallback font \"fixed\""); + } - if (!m_fontmanager->load("fixed")) - throw application_error("Unable to load fonts"); + if (!fonts_loaded && !m_fontmanager->load("fixed")) { + throw application_error("Unable to load fonts"); } m_fontmanager->allocate_color(m_opts.foreground, true);