From c9bfd934e7ccaec4f3cfa7e72d9a0f795ba87b27 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 14 May 2017 20:14:18 +0200 Subject: [PATCH] beautiful.load_font: handle font height of 0 (#1782) This might happen if no fonts are installed. It now falls back to the size from the font description. --- lib/beautiful/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/beautiful/init.lua b/lib/beautiful/init.lua index b953a7d8a..78d25fec8 100644 --- a/lib/beautiful/init.lua +++ b/lib/beautiful/init.lua @@ -124,6 +124,12 @@ local function load_font(name) -- Calculate font height. local metrics = ctx:get_metrics(desc, nil) local height = math.ceil((metrics:get_ascent() + metrics:get_descent()) / Pango.SCALE) + if height == 0 then + height = desc:get_size() / Pango.SCALE + gears_debug.print_warning(string.format( + "beautiful.load_font: could not get height for '%s' (likely missing font), using %d.", + name, height)) + end local font = { name = name, description = desc, height = height } fonts[name] = font