mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
OTD formatting errors with BDF font
This commit is contained in:
@@ -206,13 +206,15 @@ class OfTheDayManager:
|
|||||||
# Calculate title width and actual height for proper spacing
|
# Calculate title width and actual height for proper spacing
|
||||||
title_width = 0
|
title_width = 0
|
||||||
max_title_height = 0
|
max_title_height = 0
|
||||||
|
baseline_offset = title_face.size.height - title_face.size.ascender
|
||||||
for c in title:
|
for c in title:
|
||||||
title_face.load_char(c)
|
title_face.load_char(c)
|
||||||
title_width += title_face.glyph.advance.x
|
title_width += title_face.glyph.advance.x
|
||||||
# Track the maximum height of any character in the title
|
# Track the maximum height including baseline offset
|
||||||
bitmap = title_face.glyph.bitmap
|
bitmap = title_face.glyph.bitmap
|
||||||
if bitmap.rows > max_title_height:
|
actual_height = baseline_offset + bitmap.rows
|
||||||
max_title_height = bitmap.rows
|
if actual_height > max_title_height:
|
||||||
|
max_title_height = actual_height
|
||||||
title_width = title_width // 64
|
title_width = title_width // 64
|
||||||
|
|
||||||
# Underline below title using actual title height
|
# Underline below title using actual title height
|
||||||
|
|||||||
Reference in New Issue
Block a user