What happens
In ledmatrix-music, a track with an album name draws the artist and album lines on top of each other. Instrumenting the layout shows why:
128x32 font_heights: title=8, artist=0, album=0 positions - title: 1, artist: 11, album: 13
128x64 font_heights: title=8, artist=0, album=0 positions - title: 2, artist: 14, album: 18
artist_height and album_height are 0. The plugin stacks rows as
next_y = prev_y + prev_height + line_gap, so with a height of 0 the album row lands one line_gap below the artist row rather than a full row below. The artist string is 7px tall, so the two overlap almost completely.
It is not a short-panel clamp — it happens at 128x64 too — and not a frame-stepping artifact: it reproduces with a single display() call.
Why the height is 0
The artist and album rows default to 5x7.bdf, which resolves to display_manager.bdf_5x7_font. In the core's DisplayManager that face is built like this:
face = freetype.Face(self.calendar_font_path)
logger.info(f"Calendar font size: {face.size.height >> 6} pixels")
self.calendar_font = face
...
self.bdf_5x7_font = self.calendar_font
There is no set_char_size() call, so face.size.height stays 0 and get_font_height() — which returns font.size.height >> 6 for a FreeType face — returns 0.
Two things worth noting:
- The core's own log line already prints the symptom. That
logger.info emits Calendar font size: 0 pixels on every start-up.
- The core contradicts itself.
font_manager._load_bdf() does call face.set_char_size(size_px * 64, size_px * 64, 72, 72) right after constructing the face. DisplayManager does not. So whether get_font_height() works depends on which path loaded the face.
The real DisplayManager and the testing VisualTestDisplayManager construct the face the same way, so this is not a harness artifact — it is what a real install does.
Fix here vs fix in the core
The proper fix is in the core: either call set_char_size() in DisplayManager alongside the font_manager path, or have get_font_height() fall back when size.height is 0. That is the other repo, so I have not touched it.
Plugin-side, ledmatrix-music now refuses to believe a zero: it falls back to the configured font_size (which is what the row was asked to be) and then to a sane default. Rows come out at 1 / 11 / 20 on a 32px panel instead of 1 / 11 / 13.
Other plugins to check
Four plugins call get_font_height() and also reference BDF fonts:
ledmatrix-music — confirmed broken, fixed in the PR that accompanies this issue
calendar
clock-simple
ledmatrix-flights
I have not verified whether the other three actually pass a BDF face to get_font_height() (several use it only on TTF fonts, where getmetrics() works). Worth checking each before assuming.
What happens
In
ledmatrix-music, a track with an album name draws the artist and album lines on top of each other. Instrumenting the layout shows why:artist_heightandalbum_heightare 0. The plugin stacks rows asnext_y = prev_y + prev_height + line_gap, so with a height of 0 the album row lands oneline_gapbelow the artist row rather than a full row below. The artist string is 7px tall, so the two overlap almost completely.It is not a short-panel clamp — it happens at 128x64 too — and not a frame-stepping artifact: it reproduces with a single
display()call.Why the height is 0
The artist and album rows default to
5x7.bdf, which resolves todisplay_manager.bdf_5x7_font. In the core'sDisplayManagerthat face is built like this:There is no
set_char_size()call, soface.size.heightstays 0 andget_font_height()— which returnsfont.size.height >> 6for a FreeType face — returns 0.Two things worth noting:
logger.infoemitsCalendar font size: 0 pixelson every start-up.font_manager._load_bdf()does callface.set_char_size(size_px * 64, size_px * 64, 72, 72)right after constructing the face.DisplayManagerdoes not. So whetherget_font_height()works depends on which path loaded the face.The real
DisplayManagerand the testingVisualTestDisplayManagerconstruct the face the same way, so this is not a harness artifact — it is what a real install does.Fix here vs fix in the core
The proper fix is in the core: either call
set_char_size()inDisplayManageralongside thefont_managerpath, or haveget_font_height()fall back whensize.heightis 0. That is the other repo, so I have not touched it.Plugin-side,
ledmatrix-musicnow refuses to believe a zero: it falls back to the configuredfont_size(which is what the row was asked to be) and then to a sane default. Rows come out at 1 / 11 / 20 on a 32px panel instead of 1 / 11 / 13.Other plugins to check
Four plugins call
get_font_height()and also reference BDF fonts:ledmatrix-music— confirmed broken, fixed in the PR that accompanies this issuecalendarclock-simpleledmatrix-flightsI have not verified whether the other three actually pass a BDF face to
get_font_height()(several use it only on TTF fonts, wheregetmetrics()works). Worth checking each before assuming.