mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
use font scender, whatever that is
This commit is contained in:
@@ -171,14 +171,18 @@ class OfTheDayManager:
|
||||
for char in text:
|
||||
face.load_char(char)
|
||||
bitmap = face.glyph.bitmap
|
||||
# Simple approach: draw each character at the specified y position
|
||||
# Calculate baseline position
|
||||
# For BDF fonts, we need to account for the font's baseline
|
||||
# bitmap_top is relative to the baseline, so we need to adjust
|
||||
baseline_y = y + face.size.ascender
|
||||
glyph_y = baseline_y + face.glyph.bitmap_top - bitmap.rows
|
||||
for i in range(bitmap.rows):
|
||||
for j in range(bitmap.width):
|
||||
byte_index = i * bitmap.pitch + (j // 8)
|
||||
if byte_index < len(bitmap.buffer):
|
||||
byte = bitmap.buffer[byte_index]
|
||||
if byte & (1 << (7 - (j % 8))):
|
||||
draw.point((x + j, y + i), fill=color)
|
||||
draw.point((x + j, glyph_y + i), fill=color)
|
||||
x += face.glyph.advance.x >> 6
|
||||
return x - orig_x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user