If FcNameParse returns NULL FcDefaultSubstitute segfaults
We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.
Fixes#1435
In the previous implementation, std::find() returned fns.end() several times,
which caused an "Address boundary error" in std::sort if the preferred
font-index was set to m_fonts.size() + 1.
This commit reimplements the font prioritization with a simple swap.
Reproduction steps:
- Start polybar with the following config:
[bar/top]
font-0 = NotoSans-Regular:size=8;0
font-1 = MaterialIcons:size=10;0
modules-left = date
[module/date]
type = internal/date
date = %Y-%m-%d
label-font = 3 ; invalid index
This tries to mimic the old renderer's behavior as closely as possible.
In the absence of any information, DPI is assumed to be 96x96. DPI can
be configured on a per-bar basis using the configuration key "dpi".
To use the DPI configuration from Xresources (if built with support),
one can specify the following in the bar config:
dpi = ${xrdb:Xft.dpi:96}