summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-02-04 22:06:49 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-02-04 22:15:59 (GMT)
commita124734ff2f6f6cdb81a462db2c89ba8f0c81190 (patch)
tree1f4f8f34b95762ef7cfd2954ec15aa802fa93de1 /wasp
parent463ba50d2bdf743d3a3d24b4cb6a993a14a085cb (diff)
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>
Diffstat (limited to 'wasp')
-rw-r--r--wasp/draw565.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py
index 37e96b5..884d1a8 100644
--- a/wasp/draw565.py
+++ b/wasp/draw565.py
@@ -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)