diff options
| author | kozova1 <mug66kk@gmail.com> | 2021-02-01 10:12:38 (GMT) |
|---|---|---|
| committer | kozova1 <mug66kk@gmail.com> | 2021-02-05 14:42:01 (GMT) |
| commit | 28dbc663769069b01d852796b124fcd923ff3c6c (patch) | |
| tree | 5bcbb92fc03ddd4b8b21e1e1a15b5ff6339a2487 /wasp/draw565.py | |
| parent | a124734ff2f6f6cdb81a462db2c89ba8f0c81190 (diff) | |
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>
Diffstat (limited to 'wasp/draw565.py')
| -rw-r--r-- | wasp/draw565.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wasp/draw565.py b/wasp/draw565.py index 884d1a8..f82a345 100644 --- a/wasp/draw565.py +++ b/wasp/draw565.py @@ -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. |
