Enabling users to set line spacing for multi-line labels

This commit is contained in:
Mike Renfro 2019-03-23 21:28:26 -05:00
parent fe32558ce0
commit f23f66d287

View file

@ -53,8 +53,9 @@ class Label(displayio.Group):
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``
:param str text: Text to display
:param int max_glyphs: The largest quantity of glyphs we will display
:param int color: Color of all text in RGB hex"""
def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, **kwargs):
:param int color: Color of all text in RGB hex
:param double line_spacing: Line spacing of text to display"""
def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, line_spacing=1.25, **kwargs):
if not max_glyphs and not text:
raise RuntimeError("Please provide a max size, or initial text")
if not max_glyphs:
@ -70,7 +71,7 @@ class Label(displayio.Group):
bounds = self.font.get_bounding_box()
self.height = bounds[1]
self._line_spacing = 1.25
self._line_spacing = line_spacing
self._boundingbox = None
if text: