summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-08-09 20:23:39 (GMT)
committerGitHub <noreply@github.com>2020-08-09 20:23:39 (GMT)
commita47e0921b31caf33ad3ebf5466785c5b053c5e0a (patch)
tree87bc1447cc59115b06f1bc012460bb7a175ce906 /wasp
parent2d1942f76a52ea748617791bc22022fb447f182c (diff)
parentcc34c5d46de99adf049c1e164d873f1ed0f3cd28 (diff)
Merge pull request #48 from Siroj42/master
Fix background color of strings.
Diffstat (limited to 'wasp')
-rw-r--r--wasp/draw565.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py
index 86fdb36..5e38284 100644
--- a/wasp/draw565.py
+++ b/wasp/draw565.py
@@ -291,21 +291,23 @@ class Draw565(object):
display = self._display
bgfg = self._bgfg
font = self._font
+ bg = self._bgfg >> 16
if width:
(w, h) = _bounding_box(s, font)
leftpad = (width - w) // 2
rightpad = width - w - leftpad
- self.fill(0, x, y, leftpad, h)
+ self.fill(bg, x, y, leftpad, h)
x += leftpad
for ch in s:
glyph = font.get_ch(ch)
_draw_glyph(display, glyph, x, y, bgfg)
+ self.fill(bg, x+glyph[2], y, 1, glyph[1])
x += glyph[2] + 1
if width:
- self.fill(0, x, y, rightpad, h)
+ self.fill(bg, x, y, rightpad, h)
def wrap(self, s, width):
"""Chunk a string so it can rendered within a specified width.