fix(fonts): load bitmap faces at their own size in the last two plugins - #374
Open
ChuckBuilds wants to merge 1 commit into
Open
fix(fonts): load bitmap faces at their own size in the last two plugins#374ChuckBuilds wants to merge 1 commit into
ChuckBuilds wants to merge 1 commit into
Conversation
Completes the sweep. A .bdf exists at exactly one pixel size and FreeType rejects any other with "invalid pixel size", so every bitmap face in these two pickers failed at the configured font_size and silently fell back to the default -- choosing one appeared to do nothing, with only a log warning nobody reads. Bitmap faces are now retried at the size the file's PIXEL_SIZE header declares. cozette.bdf is also removed from mqtt-notifications' picker. The file is shipped by neither the core nor the plugin, so selecting it could only ever fall back. youtube-stats never listed it. Same fix already landed for clock-simple (#362), news (#369) and tide-display (#370), which carry copies of this loader. That is five plugins with one bug, so the root cause is filed against the core as ChuckBuilds/LEDMatrix#517: FontManager.resolve_font degrades to the default face for any .bdf without signalling it, which is why each plugin had to work around it separately. Verification is unit-level rather than by render, because neither plugin draws text without credentials -- mqtt-notifications needs a broker and youtube-stats an API key, so the hash-comparison used on the other plugins produces identical "no data" screens either way. Instead the loader's own path is exercised directly: _bdf_pixel_size returns 7 for 5x7.bdf and 6 for 4x6.bdf, ImageFont.truetype fails for both at size 8, and succeeds at the reported native size. That is exactly the branch the fix takes. The harness passes 8/8 for both. mqtt-notifications could not be harnessed at all before this: it fails to instantiate without paho-mqtt, which is in its requirements.txt but not in the core's environment, so anyone running check_plugin without installing it first sees eight load errors rather than a result. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 medium |
🟢 Metrics 17 complexity
Metric Results Complexity 17
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the bitmap-font sweep you asked about.
mqtt-notificationsandyoutube-statswere the last two carrying this loader.The bug, once more
A
.bdfexists at exactly one pixel size and FreeType rejects any other withinvalid pixel size. Every bitmap face in these pickers failed at the configuredfont_sizeand silently fell back to the default — the setting appeared to do nothing, with only a log warning nobody reads.Bitmap faces are now retried at the size the file's
PIXEL_SIZEheader declares.cozette.bdfis also dropped frommqtt-notifications' picker: shipped by neither the core nor the plugin, so it could only ever fall back.youtube-statsnever listed it.That's five plugins with one bug (clock-simple #362, news #369, tide-display #370, plus these two). I've filed the root cause against the core as ChuckBuilds/LEDMatrix#517 —
FontManager.resolve_fontdegrades to the default face for any.bdfwithout signalling it, which is why each plugin had to work around it separately. If that lands, these five copies can drop their workarounds.Verification is unit-level here, deliberately
Neither plugin draws text without credentials —
mqtt-notificationsneeds a broker,youtube-statsan API key — so the hash-comparison I've used elsewhere produces identical "no data" screens whatever font is set. It would have looked like a pass while proving nothing.Instead the loader's own path is exercised directly:
That is exactly the branch the fix takes.
A side finding
mqtt-notificationscould not be harnessed at all before this. It fails to instantiate withoutpaho-mqtt— which is in itsrequirements.txt, but not in the core's environment — socheck_plugin.pyreturns eight load errors rather than a result:I installed it locally and the plugin then passes 8/8. Worth knowing if CI runs the harness without installing plugin requirements first — that plugin would be failing silently in the same way.
Verification
check_plugin.py— 8/8 PASS for both (mqtt after installingpaho-mqtt)check_module_collisions.py— OK across 43 pluginsplugins.jsonregeneratedIssues filed alongside this
Per your request, findings I'm not fixing here are now tracked rather than left in PR descriptions:
[of-the-day]golden drift on all eight sizes, pre-existing onmain[static-image]rotation_mode: "date_based"is a stub that always shows the first image[sports]dynamic_duration.min_duration_secondsandbackground_service.max_workersare never readFontManagerroot cause above🤖 Generated with Claude Code