Skip to content

Commit a7ddd6d

Browse files
authored
Merge pull request #7 from mikerenfro/master
Enabling users to set line spacing for multi-line labels
2 parents fe32558 + 8f731e1 commit a7ddd6d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

adafruit_display_text/label.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ class Label(displayio.Group):
5353
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``
5454
:param str text: Text to display
5555
:param int max_glyphs: The largest quantity of glyphs we will display
56-
:param int color: Color of all text in RGB hex"""
57-
def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, **kwargs):
56+
:param int color: Color of all text in RGB hex
57+
:param double line_spacing: Line spacing of text to display"""
58+
def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff,
59+
line_spacing=1.25, **kwargs):
5860
if not max_glyphs and not text:
5961
raise RuntimeError("Please provide a max size, or initial text")
6062
if not max_glyphs:
@@ -70,7 +72,7 @@ def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, **kwargs
7072

7173
bounds = self.font.get_bounding_box()
7274
self.height = bounds[1]
73-
self._line_spacing = 1.25
75+
self._line_spacing = line_spacing
7476
self._boundingbox = None
7577

7678
if text:

0 commit comments

Comments
 (0)