summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-28 14:28:54 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-28 14:28:54 (GMT)
commit01a7ad4d788bd7b26060081e896cb921e9b2689d (patch)
tree6a34b345261bf4d7f854cea3289c11a48dfa8f20 /wasp
parent8c1ab8525781e4f8dd20c0408f4a4b6b370ee7d3 (diff)
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 <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp')
-rw-r--r--wasp/draw565.py3
1 files changed, 3 insertions, 0 deletions
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)