mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
refactor: switch to tom-thumb.bdf font for testing
This commit is contained in:
@@ -10,13 +10,13 @@ logging.basicConfig(level=logging.INFO)
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class FontTestManager:
|
class FontTestManager:
|
||||||
"""Manager for testing different font sizes of m3x6 font."""
|
"""Manager for testing different font sizes of tom-thumb font."""
|
||||||
|
|
||||||
def __init__(self, config: Dict[str, Any], display_manager: DisplayManager):
|
def __init__(self, config: Dict[str, Any], display_manager: DisplayManager):
|
||||||
self.display_manager = display_manager
|
self.display_manager = display_manager
|
||||||
self.config = config
|
self.config = config
|
||||||
self.font_path = "assets/fonts/m3x6.ttf"
|
self.font_path = "assets/fonts/tom-thumb.bdf"
|
||||||
self.font_sizes = [3, 4, 5, 6, 7, 8]
|
self.font_sizes = [4, 5, 6, 7, 8, 9] # Adjusted sizes for BDF font
|
||||||
self.logger = logging.getLogger('FontTest')
|
self.logger = logging.getLogger('FontTest')
|
||||||
|
|
||||||
# Verify font exists
|
# Verify font exists
|
||||||
@@ -24,7 +24,7 @@ class FontTestManager:
|
|||||||
self.logger.error(f"Font file not found: {self.font_path}")
|
self.logger.error(f"Font file not found: {self.font_path}")
|
||||||
raise FileNotFoundError(f"Font file not found: {self.font_path}")
|
raise FileNotFoundError(f"Font file not found: {self.font_path}")
|
||||||
|
|
||||||
self.logger.info(f"Initialized FontTestManager with {len(self.font_sizes)} font sizes to test using m3x6 font")
|
self.logger.info(f"Initialized FontTestManager with {len(self.font_sizes)} font sizes to test using tom-thumb font")
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""No update needed for static display."""
|
"""No update needed for static display."""
|
||||||
@@ -45,14 +45,14 @@ class FontTestManager:
|
|||||||
spacing = width // (total_sizes + 1) # Add 1 to account for edges
|
spacing = width // (total_sizes + 1) # Add 1 to account for edges
|
||||||
|
|
||||||
# Draw font name at the top
|
# Draw font name at the top
|
||||||
self.display_manager.draw_text("m3x6", y=2, color=(255, 255, 255))
|
self.display_manager.draw_text("tom-thumb", y=2, color=(255, 255, 255))
|
||||||
|
|
||||||
# Draw each font size
|
# Draw each font size
|
||||||
draw = ImageDraw.Draw(self.display_manager.image)
|
draw = ImageDraw.Draw(self.display_manager.image)
|
||||||
|
|
||||||
for i, size in enumerate(self.font_sizes):
|
for i, size in enumerate(self.font_sizes):
|
||||||
# Load the font at the current size
|
# Load the BDF font
|
||||||
font = ImageFont.truetype(self.font_path, size)
|
font = ImageFont.load(self.font_path)
|
||||||
|
|
||||||
# Create text to display (the size number)
|
# Create text to display (the size number)
|
||||||
text = str(size)
|
text = str(size)
|
||||||
|
|||||||
Reference in New Issue
Block a user