Skip to content

Commit afa4c53

Browse files
committed
Add font customization
Fixes #36
1 parent 22fcf15 commit afa4c53

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

adafruit_max7219/matrices.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,25 @@ 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")
6372
"""
64-
self.framebuf.text(strg, xpos, ypos, bit_value)
73+
self.framebuf.text(strg, xpos, ypos, bit_value, font_name=font_name)
6574

6675
def clear_all(self) -> None:
6776
"""

0 commit comments

Comments
 (0)