Skip to content

Feat/ssd1306 bigfont#7241

Open
chof747 wants to merge 12 commits into
Klipper3d:masterfrom
chof747:feat/ssd1306-bigfont
Open

Feat/ssd1306 bigfont#7241
chof747 wants to merge 12 commits into
Klipper3d:masterfrom
chof747:feat/ssd1306-bigfont

Conversation

@chof747

@chof747 chof747 commented Mar 27, 2026

Copy link
Copy Markdown

Intent

Extends the build-in VGA fonts with configurable text fonts for OLED displays. To enable larger/custom fonts on SSD1306/SH1106 displays.

High-Level Solution

Introduce a pluggable font pipeline in Klipper display code.
A new [display_font <name>] section defines external font profiles (currently bdf), and [display] can select one via font: <name>. OLED rendering is updated to use dynamic font metrics and panel height (32/64) instead of fixed assumptions.

High-Level Changes

Code

  • Added new font subsystem under klippy/extras/display/fonts/ (using the strategy pattern to load different font file formats and use adequate swizzle algorithms).
  • Updated klippy/extras/display/display.py to:
    • load [display_font <name>] sections
    • accept font: in [display]
    • validate profile/display compatibility
  • Updated klippy/extras/display/uc1701.py to:
    • support runtime font profiles
    • render text using variable font width/height
    • support OLED height (32/64) in init/config logic
  • Additional minor change: Added .vscode/ to .gitignore to allow cuatomized vscode local dev setups.

Docs

  • Added config/sample-display-font.cfg example.
  • Updated docs/Config_Reference.md with:
    • new [display_font] section
    • new [display] font option
    • OLED height option details
  • Updated docs/FAQ.md with custom-font troubleshooting.
  • Added entry to docs/Config_Changes.md.

Tests

  • Added new tests for the display_font specifications and display settings.
  • Added tests for font loading.

chof747 added 11 commits March 14, 2026 09:35
Added self.font_profile, glyphs and profile fallback character as new parameters of the DisplayBase class to wire up the added display_font config section.

Signed-off-by: Christian Hofbauer <chof@gmx.at>
Added the following classes following the strategy pattern to customize font source loading, swizzling and font cache building:

- FontSourceStrategy:  Loads the font and return font parameters
- SwizzleStrategy: Convert from "rows of pixels" format to display native format
- FontCacheBuilder: Combines the sourcing with swizzling to load a font ready for the display

Signed-off-by: Christian.Hofbauer <chof@gmx.at>
…EDs with klippy

- introduce font rading and swizzling strategies
- add `BuiltinVGAFontSource` and `PageSwizzleStrategy` to provide builtin and external font loading
- refactor `uc1701.DisplayBase` to use swizzled `FontObject` rendering (dynamic glyph width/pages) instead of hardcoded VGA tuples
- add SSD1306 panel `height` support (`32|64`) and select mux/COM init commands from configured panel height to allow customizable line heights

- move `DisplayFont` config parsing into `klippy/extras/display/fonts` and wire `[display] font` to OLED chips in `display.py`
- rename and integrate BDF loader as `BdfFontSource` with strategy registration in `DISPLAY_FONT_SourcingStrategies`

Signed-off-by: Christian.Hofbauer <chof@gmx.at>
…tion out of the repository

Signed-off-by: Christian.Hofbauer <chof@gmx.at>
Includes sample configuration, trouble shooting in the FAQ and entry into the config change log

Signed-off-by: Christian.Hofbauer <chof@gmx.at>
Signed-off-by: Christian.Hofbauer <chof@gmx.at>
Signed-off-by: Christian.Hofbauer <chof@gmx.at>
Signed-off-by: Christian.Hofbauer <chof@gmx.at>
Signed-off-by: Christian.Hofbauer <chof@gmx.at>
@github-actions

Copy link
Copy Markdown

Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html

There are some steps that you can take now:

  1. Perform a self-review of your Pull Request by following the steps at: https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review
    If you have completed a self-review, be sure to state the results of that self-review explicitly in the Pull Request comments. A reviewer is more likely to participate if the bulk of a review has already been completed.
  2. Consider opening a topic on the Klipper Discourse server to discuss this work. The Discourse server is a good place to discuss development ideas and to engage users interested in testing. Reviewers are more likely to prioritize Pull Requests with an active community of users.
  3. Consider helping out reviewers by reviewing other Klipper Pull Requests. Taking the time to perform a careful and detailed review of others work is appreciated. Regular contributors are more likely to prioritize the contributions of other regular contributors.

Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant