Skip to content

Commit

Permalink
Widget: Fix setting default font
Browse files Browse the repository at this point in the history
defpattern can be NULL to request the default font if nothing else is
configured, handle this case correctly.
  • Loading branch information
Zirias committed Jul 31, 2024
1 parent 31fc16c commit 98c35d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bin/xmoji/widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ void Widget_setFontResName(void *self, const char *name,
const char *pattern = XRdb_value(rdb,
XRdbKey(Widget_resname(self), name), XRQF_OVERRIDES);
char *reqpat = 0;
if (pattern)
if (pattern && defpattern)
{
reqpat = PSC_malloc(strlen(pattern) + strlen(defpattern) + 2);
strcpy(reqpat, pattern);
strcat(reqpat, ",");
strcat(reqpat, defpattern);
pattern = reqpat;
}
else pattern = defpattern;
else if (!pattern) pattern = defpattern;
Font *font = Font_create(pattern, options);
free(reqpat);
doSetFont(Object_instance(self), font);
Expand Down

0 comments on commit 98c35d5

Please sign in to comment.