1
0
Fork 0

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>
This commit is contained in:
Daniel Thompson 2020-12-28 14:28:54 +00:00
parent 8c1ab85257
commit 01a7ad4d78

View file

@ -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)