mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
change music fonts
This commit is contained in:
@@ -199,6 +199,11 @@ class DisplayManager:
|
|||||||
logger.error("Falling back to small font")
|
logger.error("Falling back to small font")
|
||||||
self.calendar_font = self.small_font
|
self.calendar_font = self.small_font
|
||||||
|
|
||||||
|
# Assign the loaded calendar_font (which should be 5x7 BDF or its fallback)
|
||||||
|
# to a new attribute for specific use, e.g., in MusicManager.
|
||||||
|
self.bdf_5x7_font = self.calendar_font
|
||||||
|
logger.info(f"Assigned calendar_font (type: {type(self.bdf_5x7_font).__name__}) to bdf_5x7_font.")
|
||||||
|
|
||||||
# Load 4x6 font as extra_small_font
|
# Load 4x6 font as extra_small_font
|
||||||
try:
|
try:
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
@@ -219,6 +224,8 @@ class DisplayManager:
|
|||||||
self.calendar_font = self.regular_font
|
self.calendar_font = self.regular_font
|
||||||
if not hasattr(self, 'extra_small_font'):
|
if not hasattr(self, 'extra_small_font'):
|
||||||
self.extra_small_font = self.regular_font
|
self.extra_small_font = self.regular_font
|
||||||
|
if not hasattr(self, 'bdf_5x7_font'): # Ensure bdf_5x7_font also gets a fallback
|
||||||
|
self.bdf_5x7_font = self.regular_font
|
||||||
|
|
||||||
def get_text_width(self, text, font):
|
def get_text_width(self, text, font):
|
||||||
"""Get the width of text when rendered with the given font."""
|
"""Get the width of text when rendered with the given font."""
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ class MusicManager:
|
|||||||
album = display_info.get('album', ' ')
|
album = display_info.get('album', ' ')
|
||||||
|
|
||||||
font_title = self.display_manager.small_font
|
font_title = self.display_manager.small_font
|
||||||
font_artist_album = self.display_manager.extra_small_font
|
font_artist_album = self.display_manager.bdf_5x7_font
|
||||||
line_height_title = 8
|
line_height_title = 8
|
||||||
line_height_artist_album = 7
|
line_height_artist_album = 7
|
||||||
padding_between_lines = 1
|
padding_between_lines = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user