Skip to content

Commit 4100a76

Browse files
committed
add custom font capability to product overlay
1 parent 49f2981 commit 4100a76

File tree

1 file changed

+10
-3
lines changed
  • Fruit_Jam/Fruit_Jam_Product_Overlay

1 file changed

+10
-3
lines changed

Fruit_Jam/Fruit_Jam_Product_Overlay/code.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
import time
66
import board
77
import supervisor
8+
import terminalio
89

910
from adafruit_fruitjam import FruitJam
1011
from adafruit_fruitjam.peripherals import request_display_config
1112

1213
BG_COLOR = 0x0000FF
1314

15+
# use built-in system font
16+
OVERLAY_FONT = terminalio.FONT
17+
18+
# or un-comment to use a custom font. Fill in the path to your font file.
19+
# OVERLAY_FONT = "Free_Mono_10.pcf"
20+
1421
request_display_config(320, 240)
1522
display = supervisor.runtime.display
1623

@@ -139,12 +146,12 @@ def format_data(json_data):
139146
)
140147
fruitjam.remove_all_text()
141148
fruitjam.add_text(
142-
text_wrap=35, text_maxlen=180, text_color=0xFFFFFF, outline_size=1
149+
text_font=OVERLAY_FONT, text_wrap=35, text_maxlen=180, text_color=0xFFFFFF, outline_size=1
143150
) # title
144151
fruitjam.add_text(
145-
text_wrap=0, text_maxlen=30, text_color=0xFFFFFF, outline_size=1
152+
text_font=OVERLAY_FONT, text_wrap=0, text_maxlen=30, text_color=0xFFFFFF, outline_size=1
146153
) # stock
147-
fruitjam.add_text(text_wrap=0, text_maxlen=30, text_color=0xFFFFFF, outline_size=1) #
154+
fruitjam.add_text(text_font=OVERLAY_FONT, text_wrap=0, text_maxlen=30, text_color=0xFFFFFF, outline_size=1) #
148155
apply_hotkey_visuals(config_index)
149156

150157
fruitjam.neopixels.brightness = 0.1

0 commit comments

Comments
 (0)