Merge branch 'master' of https://github.com/daniel-thompson/wasp-os
This commit is contained in:
commit
371011c70f
1 changed files with 4 additions and 2 deletions
|
@ -291,21 +291,23 @@ class Draw565(object):
|
||||||
display = self._display
|
display = self._display
|
||||||
bgfg = self._bgfg
|
bgfg = self._bgfg
|
||||||
font = self._font
|
font = self._font
|
||||||
|
bg = self._bgfg >> 16
|
||||||
|
|
||||||
if width:
|
if width:
|
||||||
(w, h) = _bounding_box(s, font)
|
(w, h) = _bounding_box(s, font)
|
||||||
leftpad = (width - w) // 2
|
leftpad = (width - w) // 2
|
||||||
rightpad = width - w - leftpad
|
rightpad = width - w - leftpad
|
||||||
self.fill(0, x, y, leftpad, h)
|
self.fill(bg, x, y, leftpad, h)
|
||||||
x += leftpad
|
x += leftpad
|
||||||
|
|
||||||
for ch in s:
|
for ch in s:
|
||||||
glyph = font.get_ch(ch)
|
glyph = font.get_ch(ch)
|
||||||
_draw_glyph(display, glyph, x, y, bgfg)
|
_draw_glyph(display, glyph, x, y, bgfg)
|
||||||
|
self.fill(bg, x+glyph[2], y, 1, glyph[1])
|
||||||
x += glyph[2] + 1
|
x += glyph[2] + 1
|
||||||
|
|
||||||
if width:
|
if width:
|
||||||
self.fill(0, x, y, rightpad, h)
|
self.fill(bg, x, y, rightpad, h)
|
||||||
|
|
||||||
def wrap(self, s, width):
|
def wrap(self, s, width):
|
||||||
"""Chunk a string so it can rendered within a specified width.
|
"""Chunk a string so it can rendered within a specified width.
|
||||||
|
|
Loading…
Reference in a new issue