← index #7384Issue #7253
Related · high · value 0.768
QUERY · ISSUE

framebuf: Support drawing text at different sizes

openby jonathanhoggopened 2021-06-12updated 2026-03-24
extmod

I'm increasingly making little widgets with MicroPython that use small OLED displays to present information to the user. The text support in FrameBuffer() is great, but it's limited to the built-in 8-pixel-square font. Being able to display text at different sizes makes a massive usability difference.

I've already written a patch that does simple arbitrary scaling of the built-in font and raised PR #6263. I've been using this in production devices for a year now, but supporting a bunch of patches is becoming a bore and I hate not being able to use the official releases so I'd like to get this PR mainlined as-is or some feedback on what I could change to get it accepted.

Thought that perhaps opening an issue might raise the visibility of this.

CANDIDATE · ISSUE

extmod/modframebuf: Additional colour modes and endianness handling

openby jimmoopened 2021-05-11updated 2025-09-22
extmod

There have been some PRs for additional modes for modframebuf (XRGB, RGB, VMSB), as well as clarifying the way the framebuf interacts with the host and target-display endianness (which means adding additional BE/LE modes).

#3536 -- Endianness handling for RGB565 framebuf mode.
#3551 -- extmod/modframebuf: add 24bit RGB support (RGB888)
#4880 -- extmod/modframebuf: add XRGB8888 format
#4887 -- Add support for MSB vertical mode

It's worth noting that although most MicroPython boards are unlikely to have enough RAM for an XRGB/RGB framebuffer for all but the smallest LCD/OLED displays, they are potentially very useful for things like APA102 and WS2812 LED strips,

Each new mode adds code size, and this code size affects all ports/boards that include modframebuf (most of them!). Rather than splitting this across four PRs, it would be good to consolidate (and possibly consider alternative approaches).

Some ideas for areas to investigate:

  • Implement modes more (code-size) efficiently (possibly at a speed tradeoff)
  • Making modes dynamic (i.e. via the dynamic native module mechanism) or even make framebuf not part of the core firmware and always used as a dynamic module (need a way to run .mpy files out of flash though).
  • Other colour-related improvements to framebuf (i.e. blit to a framebuf with a different colour mode, possibly supplying a palette - see #2973).

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied