mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
fix(display): Use absolute path for 4x6 font
Corrected the path for loading 4x6.bdf font to resolve "cannot find glyph data file" error.
This commit is contained in:
@@ -5,6 +5,7 @@ from typing import Dict, Any, List, Tuple
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
from .weather_icons import WeatherIcons
|
from .weather_icons import WeatherIcons
|
||||||
|
import os
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
@@ -129,9 +130,11 @@ class DisplayManager:
|
|||||||
self.small_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
self.small_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
||||||
logger.info("Press Start 2P small font loaded successfully")
|
logger.info("Press Start 2P small font loaded successfully")
|
||||||
|
|
||||||
# Add an even smaller font using 4x6.bdf
|
# Add an even smaller font using 4x6.bdf relative to script location
|
||||||
self.extra_small_font = ImageFont.load("assets/fonts/4x6.bdf")
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
logger.info("4x6.bdf extra small font loaded successfully")
|
font_path = os.path.join(script_dir, "../assets/fonts/4x6.bdf")
|
||||||
|
self.extra_small_font = ImageFont.load(font_path)
|
||||||
|
logger.info(f"4x6.bdf extra small font loaded successfully from {font_path}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in font loading: {e}")
|
logger.error(f"Error in font loading: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user