mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
font change
font changed to Press Start 2P
This commit is contained in:
BIN
assets/fonts/PressStart2P-Regular.ttf
Normal file
BIN
assets/fonts/PressStart2P-Regular.ttf
Normal file
Binary file not shown.
@@ -124,19 +124,19 @@ class DisplayManager:
|
|||||||
def _load_fonts(self):
|
def _load_fonts(self):
|
||||||
"""Load fonts optimized for LED matrix display."""
|
"""Load fonts optimized for LED matrix display."""
|
||||||
try:
|
try:
|
||||||
# Use DejaVu Sans ExtraLight for thinnest possible characters
|
# Use Press Start 2P font - perfect for LED matrix displays
|
||||||
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-ExtraLight.ttf"
|
font_path = "assets/fonts/PressStart2P-Regular.ttf"
|
||||||
|
|
||||||
# For 32px height matrix, optimized sizes for ExtraLight
|
# For 32px height matrix, optimized sizes for pixel-perfect display
|
||||||
large_size = 20 # Slightly larger since ExtraLight is very thin
|
large_size = 16 # Good size for time display
|
||||||
small_size = 10 # Slightly larger for better visibility
|
small_size = 8 # Perfect for secondary information
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.font = ImageFont.truetype(font_path, large_size)
|
self.font = ImageFont.truetype(font_path, large_size)
|
||||||
self.small_font = ImageFont.truetype(font_path, small_size)
|
self.small_font = ImageFont.truetype(font_path, small_size)
|
||||||
logger.info(f"Loaded ExtraLight font: {font_path} (large: {large_size}px, small: {small_size}px)")
|
logger.info(f"Loaded Press Start 2P font: {font_path} (large: {large_size}px, small: {small_size}px)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to load ExtraLight font, falling back to default: {e}")
|
logger.warning(f"Failed to load Press Start 2P font, falling back to default: {e}")
|
||||||
self.font = ImageFont.load_default()
|
self.font = ImageFont.load_default()
|
||||||
self.small_font = ImageFont.load_default()
|
self.small_font = ImageFont.load_default()
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class DisplayManager:
|
|||||||
text_height = bbox[3] - bbox[1]
|
text_height = bbox[3] - bbox[1]
|
||||||
|
|
||||||
# Add padding to prevent cutoff
|
# Add padding to prevent cutoff
|
||||||
padding = 2
|
padding = 1 # Reduced padding since Press Start 2P has built-in spacing
|
||||||
|
|
||||||
# Center text horizontally if x not specified
|
# Center text horizontally if x not specified
|
||||||
if x is None:
|
if x is None:
|
||||||
@@ -170,7 +170,7 @@ class DisplayManager:
|
|||||||
y = min(y, max_y)
|
y = min(y, max_y)
|
||||||
y = max(y, padding) # Ensure text doesn't get cut off at top
|
y = max(y, padding) # Ensure text doesn't get cut off at top
|
||||||
|
|
||||||
# For Light font, we can use full brightness since the characters are thinner
|
# Press Start 2P is pixel-perfect, so we can draw directly without any adjustments
|
||||||
self.draw.text((x, y), text, font=font, fill=color)
|
self.draw.text((x, y), text, font=font, fill=color)
|
||||||
|
|
||||||
def draw_sun(self, x: int, y: int, size: int = 16):
|
def draw_sun(self, x: int, y: int, size: int = 16):
|
||||||
|
|||||||
Reference in New Issue
Block a user