summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2024-08-02 09:03:40 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2024-08-02 09:03:40 +0200
commite7da3828207713d529a10e093a40d5abba1c0220 (patch)
tree7320ad1a7c7e891c00827e9b2867a1e0fbc2d536 /src/util.c
parente8fc1baf5ad574a01b65e3a3ec415f212f326550 (diff)
parent64edeaaa4c7492d090b4069de2eae5f411ff1cd4 (diff)
Merge remote-tracking branch 'origin/master' into obsdobsd
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index bae9269..e25206a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -602,6 +602,7 @@ FindFontSet(MyFont *font, const char *fontname)
twmVerbose("font for charset %s is lacking.",
missing_charset_list_return[i]);
}
+ XFreeStringList(missing_charset_list_return);
}
font_extents = XExtentsOfFontSet(font->fontset);
@@ -667,6 +668,24 @@ GetFont(MyFont *font)
}
}
+void
+DestroyFont(MyFont *font)
+{
+ if (!font) {
+ return;
+ }
+
+ if (font->fontset) {
+ XFreeFontSet(dpy, font->fontset);
+ font->fontset = NULL;
+ }
+
+ if (font->font) {
+ XFreeFont(dpy, font->font);
+ font->font = NULL;
+ }
+}
+
int
MyFont_TextWidth(MyFont *font, const char *string, int len)
{