From 01a7ad4d788bd7b26060081e896cb921e9b2689d Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Mon, 28 Dec 2020 14:28:54 +0000 Subject: draw565: Handle empty strings when calculating the bounding box Currently the empty string cannot be drawn into a fixed width box. Fix this by adding a special case for empty strings. Signed-off-by: Daniel Thompson diff --git a/wasp/draw565.py b/wasp/draw565.py index f55977d..842b533 100644 --- a/wasp/draw565.py +++ b/wasp/draw565.py @@ -65,6 +65,9 @@ def _fill(mv, color: int, count: int, offset: int): p[x] = color def _bounding_box(s, font): + if not s: + return (0, font.height()) + w = 0 for ch in s: (_, h, wc) = font.get_ch(ch) -- cgit v0.10.2