Skip to content

Commit 693b455

Browse files
authored
Merge pull request #3125 from FoamyGuy/product_overlay_custom_font
add custom font capability to product overlay
2 parents 28c26a1 + d1ebd21 commit 693b455

File tree

1 file changed

+12
-3
lines changed
  • Fruit_Jam/Fruit_Jam_Product_Overlay

1 file changed

+12
-3
lines changed

Fruit_Jam/Fruit_Jam_Product_Overlay/code.py

Lines changed: 12 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,14 @@ 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(
155+
text_font=OVERLAY_FONT, text_wrap=0, text_maxlen=30, text_color=0xFFFFFF, outline_size=1
156+
) # price
148157
apply_hotkey_visuals(config_index)
149158

150159
fruitjam.neopixels.brightness = 0.1

0 commit comments

Comments
 (0)