From a124734ff2f6f6cdb81a462db2c89ba8f0c81190 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Thu, 4 Feb 2021 22:06:49 +0000 Subject: 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 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) -- cgit v0.10.2