mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
change how font is loaded via systemctl - added direct paths
This commit is contained in:
@@ -312,10 +312,13 @@ class BaseSoccerManager:
|
||||
"""Load fonts used by the scoreboard."""
|
||||
fonts = {}
|
||||
try:
|
||||
fonts['score'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 10) # Slightly larger score
|
||||
fonts['time'] = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
||||
fonts['team'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 6) # Keep team abbr small
|
||||
fonts['status'] = ImageFont.truetype("assets/fonts/4x6-font.ttf", 6) # Keep status small
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
ps2p = os.path.abspath(os.path.join(script_dir, "../assets/fonts/PressStart2P-Regular.ttf"))
|
||||
font_4x6 = os.path.abspath(os.path.join(script_dir, "../assets/fonts/4x6-font.ttf"))
|
||||
fonts['score'] = ImageFont.truetype(ps2p, 10) # Slightly larger score
|
||||
fonts['time'] = ImageFont.truetype(ps2p, 8)
|
||||
fonts['team'] = ImageFont.truetype(font_4x6, 6) # Keep team abbr small
|
||||
fonts['status'] = ImageFont.truetype(font_4x6, 6) # Keep status small
|
||||
logging.info("[Soccer] Successfully loaded custom fonts")
|
||||
except IOError:
|
||||
logging.warning("[Soccer] Custom fonts not found, using default PIL font.")
|
||||
@@ -410,7 +413,8 @@ class BaseSoccerManager:
|
||||
draw = ImageDraw.Draw(logo)
|
||||
# Optionally add text to placeholder
|
||||
try:
|
||||
placeholder_font = ImageFont.truetype("assets/fonts/4x6-font.ttf", 12)
|
||||
font_4x6 = os.path.abspath(os.path.join(script_dir, "../assets/fonts/4x6-font.ttf"))
|
||||
placeholder_font = ImageFont.truetype(font_4x6, 12)
|
||||
text_width = draw.textlength(team_abbrev, font=placeholder_font)
|
||||
text_x = (36 - text_width) // 2
|
||||
text_y = 10
|
||||
|
||||
Reference in New Issue
Block a user