Update display_manager.py

adjust font size
This commit is contained in:
Chuck
2025-04-08 20:53:26 -05:00
parent 219ac37b54
commit 459e3f937d

View File

@@ -60,13 +60,13 @@ class DisplayManager:
self.image = Image.new('RGB', (self.matrix.width, self.matrix.height)) self.image = Image.new('RGB', (self.matrix.width, self.matrix.height))
self.draw = ImageDraw.Draw(self.image) self.draw = ImageDraw.Draw(self.image)
# Initialize font # Initialize font with Press Start 2P
try: try:
self.font = ImageFont.truetype("DejaVuSans.ttf", 7) # Reduced to match new size self.font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 10)
logger.info("Font initialized successfully") logger.info("Initial font loaded successfully")
except Exception as e: except Exception as e:
logger.error(f"Failed to load font: {e}") logger.error(f"Failed to load initial font: {e}")
raise self.font = ImageFont.load_default()
# Draw a test pattern # Draw a test pattern
self._draw_test_pattern() self._draw_test_pattern()
@@ -128,8 +128,8 @@ class DisplayManager:
font_path = "assets/fonts/PressStart2P-Regular.ttf" font_path = "assets/fonts/PressStart2P-Regular.ttf"
# For 32px height matrix, optimized sizes for pixel-perfect display # For 32px height matrix, optimized sizes for pixel-perfect display
large_size = 7 # Reduced from 16 for better fit large_size = 10 # Large text for time and main info
small_size = 5 # Reduced from 8 for better fit small_size = 8 # Small text for secondary information
try: try:
self.font = ImageFont.truetype(font_path, large_size) self.font = ImageFont.truetype(font_path, large_size)