From 58fdf9776f9c7d151e898c6cd260c68ffff1c25f Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sat, 31 Oct 2020 15:41:06 +0000 Subject: [PATCH] Move pango_cairo_font_map_set_default() to font.c --- include/common/font.h | 6 ++++++ src/common/font.c | 6 ++++++ src/main.c | 6 ++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/common/font.h b/include/common/font.h index 9832c667..701ead53 100644 --- a/include/common/font.h +++ b/include/common/font.h @@ -7,4 +7,10 @@ */ int font_height(const char *font_description); +/** + * font_finish - free some font related resources + * Note: use on exit + */ +void font_finish(void); + #endif /* __LABWC_FONT_H */ diff --git a/src/common/font.c b/src/common/font.c index 1eaf6c62..5053cc1e 100644 --- a/src/common/font.c +++ b/src/common/font.c @@ -42,3 +42,9 @@ font_height(const char *font_description) rectangle = font_extents(font_description, "abcdefg"); return rectangle.height; } + +void +font_finish(void) +{ + pango_cairo_font_map_set_default(NULL); +} diff --git a/src/main.c b/src/main.c index efcaf5ff..0e40af5c 100644 --- a/src/main.c +++ b/src/main.c @@ -1,13 +1,11 @@ #include "common/spawn.h" +#include "common/font.h" #include "config/session.h" #include "labwc.h" #include "theme/theme.h" #include "xbm/xbm.h" #include "menu/menu.h" -#include -#include - struct rcxml rc = { 0 }; struct theme theme = { 0 }; @@ -95,6 +93,6 @@ main(int argc, char *argv[]) server_finish(&server); rcxml_finish(); menu_finish(server.rootmenu); - pango_cairo_font_map_set_default(NULL); + font_finish(); return 0; } -- 2.52.0