mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-12 13:42:59 +00:00
Fix font usage in calendar display to use available small_font
This commit is contained in:
@@ -124,23 +124,22 @@ class CalendarManager:
|
|||||||
time_str = self._format_event_time(event)
|
time_str = self._format_event_time(event)
|
||||||
date_str = self._format_event_date(event)
|
date_str = self._format_event_date(event)
|
||||||
|
|
||||||
# Use different fonts for header and summary
|
# Use display manager's font for wrapping
|
||||||
header_font = self.display_manager.small_font
|
font = self.display_manager.small_font
|
||||||
summary_font = self.display_manager.extra_small_font
|
|
||||||
available_width = self.display_manager.matrix.width - 4 # Leave 2 pixel margin on each side
|
available_width = self.display_manager.matrix.width - 4 # Leave 2 pixel margin on each side
|
||||||
|
|
||||||
# Draw date and time on top line
|
# Draw date and time on top line
|
||||||
datetime_str = f"{date_str} {time_str}"
|
datetime_str = f"{date_str} {time_str}"
|
||||||
self.display_manager.draw_text(datetime_str, y=2, color=self.text_color, small_font=True)
|
self.display_manager.draw_text(datetime_str, y=2, color=self.text_color, small_font=True)
|
||||||
|
|
||||||
# Wrap summary text for two lines using extra small font
|
# Wrap summary text for two lines
|
||||||
title_lines = self._wrap_text(summary, available_width, summary_font, max_lines=2)
|
title_lines = self._wrap_text(summary, available_width, font, max_lines=2)
|
||||||
|
|
||||||
# Draw summary lines
|
# Draw summary lines
|
||||||
y_pos = 12 # Start position for summary (below date/time)
|
y_pos = 12 # Start position for summary (below date/time)
|
||||||
for line in title_lines:
|
for line in title_lines:
|
||||||
self.display_manager.draw_text(line, y=y_pos, color=self.text_color, extra_small_font=True)
|
self.display_manager.draw_text(line, y=y_pos, color=self.text_color, small_font=True)
|
||||||
y_pos += 6 # Move down less for extra small font
|
y_pos += 8 # Move down for next line
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user