Skip to content

Commit 8b29b58

Browse files
authored
Merge pull request #47 from jerr0328/fix-36
Add font customization
2 parents 22fcf15 + 193593c commit 8b29b58

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

adafruit_max7219/matrices.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,27 @@ def init_display(self) -> None:
5252
self.fill(0)
5353
self.show()
5454

55-
def text(self, strg: str, xpos: int, ypos: int, bit_value: int = 1) -> None:
55+
def text(
56+
self,
57+
strg: str,
58+
xpos: int,
59+
ypos: int,
60+
bit_value: int = 1,
61+
*,
62+
font_name: str = "font5x8.bin"
63+
) -> None:
5664
"""
5765
Draw text in the 8x8 matrix.
5866
5967
:param str strg: string to place in to display
6068
:param int xpos: x position of LED in matrix
6169
:param int ypos: y position of LED in matrix
6270
:param int bit_value: > 1 sets the text, otherwise resets
71+
:param str font_name: path to binary font file (default: "font5x8.bin").
72+
The font can only be set once, if you want a different font you must
73+
re-initialize the matrix.
6374
"""
64-
self.framebuf.text(strg, xpos, ypos, bit_value)
75+
self.framebuf.text(strg, xpos, ypos, bit_value, font_name=font_name)
6576

6677
def clear_all(self) -> None:
6778
"""

0 commit comments

Comments
 (0)