overzealous with the font change, rolling some back

This commit is contained in:
Chuck
2025-08-13 20:54:16 -05:00
parent 6bc1039ed6
commit 0d8d4084a9
2 changed files with 8 additions and 4 deletions

View File

@@ -428,10 +428,14 @@ class StockManager:
fallback = Image.new('RGBA', (32, 32), (0, 0, 0, 0)) fallback = Image.new('RGBA', (32, 32), (0, 0, 0, 0))
draw = ImageDraw.Draw(fallback) draw = ImageDraw.Draw(fallback)
try: try:
# Resolve font path absolutely to avoid fallback under systemd # Resolve font path absolutely to avoid fallback under systemd; fall back to PS2P if missing
script_dir = os.path.dirname(os.path.abspath(__file__)) script_dir = os.path.dirname(os.path.abspath(__file__))
font_path = os.path.abspath(os.path.join(script_dir, "../assets/fonts/OpenSans-Regular.ttf")) font_path = os.path.abspath(os.path.join(script_dir, "../assets/fonts/OpenSans-Regular.ttf"))
font = ImageFont.truetype(font_path, 16) try:
font = ImageFont.truetype(font_path, 16)
except Exception:
ps2p = os.path.abspath(os.path.join(script_dir, "../assets/fonts/PressStart2P-Regular.ttf"))
font = ImageFont.truetype(ps2p, 8)
except: except:
font = ImageFont.load_default() font = ImageFont.load_default()

View File

@@ -337,8 +337,8 @@ class WeatherManager:
# --- Right Side (Below Condition): Current Temp --- # --- Right Side (Below Condition): Current Temp ---
temp = round(weather_data['main']['temp']) temp = round(weather_data['main']['temp'])
temp_text = f"{temp}°" temp_text = f"{temp}°"
# Ensure we use the intended PS2P font managed by DisplayManager # Use the small font from DisplayManager as before
temp_font = getattr(self.display_manager, 'regular_font', self.display_manager.small_font) temp_font = self.display_manager.small_font
temp_text_width = draw.textlength(temp_text, font=temp_font) temp_text_width = draw.textlength(temp_text, font=temp_font)
temp_x = self.display_manager.matrix.width - temp_text_width - 1 # Align right temp_x = self.display_manager.matrix.width - temp_text_width - 1 # Align right
temp_y = condition_y + 8 # Position below condition text (adjust 8 based on font size) temp_y = condition_y + 8 # Position below condition text (adjust 8 based on font size)