drivers: draw565: Added bounding_box() function that returns the size of a string.
This function returns a tuple of (width, height) of the string, as it would appear if used in draw.string() Signed-off-by: kozova1 <mug66kk@gmail.com>
This commit is contained in:
parent
a124734ff2
commit
28dbc66376
1 changed files with 8 additions and 0 deletions
|
@ -330,6 +330,14 @@ class Draw565(object):
|
|||
if width:
|
||||
self.fill(bg, x, y, rightpad, h)
|
||||
|
||||
def bounding_box(self, s):
|
||||
"""Return the bounding box of a string.
|
||||
|
||||
:param s: A string
|
||||
:returns: Tuple of (width, height)
|
||||
"""
|
||||
return _bounding_box(s, self._font)
|
||||
|
||||
def wrap(self, s, width):
|
||||
"""Chunk a string so it can rendered within a specified width.
|
||||
|
||||
|
|
Loading…
Reference in a new issue