1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 09:44:04 +00:00

display-wayland: avoid crash when font has no family specified (#1498)

Co-authored-by: bi4k8 <bi4k8@github>
This commit is contained in:
bi4k8 2023-04-10 17:43:46 +00:00 committed by GitHub
parent df16eeabf6
commit b874ba0d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -866,6 +866,12 @@ void display_output_wayland::load_fonts(bool utf8) {
auto &pango_font_entry = pango_fonts[i]; auto &pango_font_entry = pango_fonts[i];
FcPattern *fc_pattern = FcPattern *fc_pattern =
FcNameParse(reinterpret_cast<const unsigned char *>(font.name.c_str())); FcNameParse(reinterpret_cast<const unsigned char *>(font.name.c_str()));
// pango_fc_font_description_from_pattern requires a FAMILY to be set,
// so set an empty one if none is present.
FcValue dummy;
if (FcPatternGet (fc_pattern, FC_FAMILY, 0, &dummy) != FcResultMatch) {
FcPatternAddString (fc_pattern, FC_FAMILY, (FcChar8 *) "");
}
pango_font_entry.desc = pango_font_entry.desc =
pango_fc_font_description_from_pattern(fc_pattern, true); pango_fc_font_description_from_pattern(fc_pattern, true);