Skip to content

Commit

Permalink
change default font
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellee1019 committed Apr 12, 2024
1 parent d5aecfa commit 9df2526
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Draw a rectangle on the display. Options:
Write text to the display. Options:
- `message`: The text to display
- `start_pixel`: The xy coordinates to start the text. Helpful to center text visually. Provide the coordinates a list of two integers like `[x, y]`.
- `font`: The font to use, defaults to `CP437_FONT` if not provided. The other option is `LCD_FONT` but this font isn't ideal for this display because its hight is greater than 8 pixels.
- `font`: The font to use, defaults to `LCD_FONT` if not provided. The other option is `CP437_FONT` which provides thicker "bold" letters.
```
{
"drawings": [
Expand All @@ -61,7 +61,8 @@ Write text to the display. Options:
"start_pixel": [
3,
0
]
],
"font": "CP437_FONT"
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def border(self, draw):

def rectangle(self, draw, pixels: list[int]):
draw.rectangle(pixels, outline="white")

def text(self, draw, start_pixel: list[int], message: str, font):
font_cls = CP437_FONT
if font == "LCD_FONT":
font_cls = LCD_FONT
font_cls = LCD_FONT
if font == "CP437_FONT":
font_cls = CP437_FONT
text(draw, start_pixel, message, fill="white", font=proportional(font_cls))

def point(self, draw, pixel: list[int]):
Expand Down

0 comments on commit 9df2526

Please sign in to comment.