commit f452a00a4143a913e61a395cf9e4b8728fa0a7a6
parent b411a0c6e0d45f347be63ffb40dc62092ab8c3c1
Author: lumidify <nobody@lumidify.org>
Date:   Wed, 17 Feb 2021 19:36:41 +0100
Fix crash with pango renderer
Diffstat:
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/testbox.sh b/testbox.sh
@@ -22,4 +22,4 @@ do
 		printf "%s\n" "$cmd" >&2
 		;;
 	esac
-done | ./ltkc $ltk_id
+done | ./ltkc $ltk_id > /dev/null
diff --git a/text_pango.c b/text_pango.c
@@ -82,6 +82,8 @@ ltk_text_line_create(Window window, uint16_t font_size, char *text, int width) {
 	pango_layout_get_size(line->layout, &line->w, &line->h);
 	line->w /= PANGO_SCALE;
 	line->h /= PANGO_SCALE;
+	line->w = line->w == 0 ? 1 : line->w;
+	line->h = line->h == 0 ? 1 : line->h;
 	XWindowAttributes attrs;
 	XGetWindowAttributes(tm.dpy, window, &attrs);
 	line->pixmap = XCreatePixmap(tm.dpy, window, line->w, line->h, attrs.depth);