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:
parent
8c1ab85257
commit
01a7ad4d78
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue