1
0
Fork 0

draw565: Fix an out-by-one error in _bounding_box

Currently we add an extra blank pixel to the end of the string but this
is not required.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
Daniel Thompson 2021-02-04 22:06:49 +00:00
parent 463ba50d2b
commit a124734ff2

View file

@ -74,10 +74,11 @@ def _bounding_box(s, font):
if not s:
return (0, font.height())
w = 0
get_ch = font.get_ch
w = len(s) - 1
for ch in s:
(_, h, wc) = font.get_ch(ch)
w += wc + 1
(_, h, wc) = get_ch(ch)
w += wc
return (w, h)