Releases: pimoroni/pimoroni-pico
Version 1.24.0 - Beta 1
This release is based upon MicroPython 1.24.0 which introduces, among other things, support for the RP2350 chip found in the Pico 2 and our own boards. Since RP2350 is new, and we've been busy working on various new features and bugfixes to accompany it, this release should be considered beta.
Doing A Thing With PPP
You'll notice a new "ppp" build, this includes MicroPython's new PPP support, leveraging UART to talk to networking modules like our Clipper LTE Breakout. We need a standalone build for this because PPP and networking support are bulky, requiring a 1MB/1MB filesystem split.
See https://github.com/pimoroni/pimoroni-pico-rp2350/blob/main/micropython/examples/pico_plus_2/breakouts/lte-catfacts.py for an example of how to get the LTE module up and running with Pico!
PicoVector Changes Again
We've completely overhauled PicoVector more or less from the ground up, this includes changes to drawing operations, font formats and a whole bunch of plumbing changes which render it quite incompatible with old PicoVector code. If you've got some existing code you want to port over, chime in on #1026
PicoGraphics Layers
We've introduced the concept of layers into PicoGraphics. This is a fairly memory intensive feature that lets you create a PicoGraphics
instance with multiple drawing layers. It doesn't have much practical use on RP2040 builds - ie: most of the boards supported here - but can be very useful on the RP2350. Documentation and examples are scarce while we work out how it fits into the bigger picture.
Non-blocking Inky Frame
Inky Frame has gained a non-blocking mode, so you can put that 20-second refresh time to better use. Find out more at #936
What's Changed
- Add SPI import to SD card upload example by @johnbintz in #960
- AS7343 examples tidy by @helgibbons in #961
- Documentation: RV3028 by @thirdr in #955
- Move nano specs hack into our module cmake files. by @Gadgetoid in #968
- docs: add link to readme by @helgibbons in #969
- Docs: update GFX Pack readme by @helgibbons in #972
- Picographics: Update README.md by @helgibbons in #977
- Pico Display 2.8": Update examples by @helgibbons in #973
- CI: Pin SDK version to 1.5.1. by @Gadgetoid in #979
- CI: Bump Pico SDK to 2.0.0. 🎉 by @Gadgetoid in #980
- Tinyweb: Sync with upstream. by @Gadgetoid in #986
- Pico Display 2.x: example menus by @thirdr in #982
- Update setup instructions for macOS by @stephenhouser in #991
- as7343: Fix channel and status order. by @Gadgetoid in #993
- Pico Display 2.x: Fixed button function by @thirdr in #1003
- Plasma Stick 2040 W: add link by @helgibbons in #1016
- More fixes for SDK 2.0.0 by @Gadgetoid in #1008
- CI: Switch to action-gh-release. by @Gadgetoid in #1018
- Allow spritesheets for PenRGB565 by @waffshappen in #959
- A roundup of not necessarily related fixes from other branches by @Gadgetoid in #1020
- Add Garbage Collection to weather example by @LeePorte in #974
- Fix linting fail. by @Gadgetoid in #1021
- Bump to MicroPython v1.24.0 by @Gadgetoid in #1024
- fix: [url] placekitten.com is down, someone created a drop in replacement, placecats.com by @SteveClement in #1022
New Contributors
- @johnbintz made their first contribution in #960
- @stephenhouser made their first contribution in #991
- @waffshappen made their first contribution in #959
- @LeePorte made their first contribution in #974
- @SteveClement made their first contribution in #1022
Full Changelog: v1.23.0-1...v1.24.0-rc0
MicroPython Changelog: micropython/micropython@v1.23.0...v1.24.0
Version 1.23.0 - Bugfix 1
This release is basically v1.23.0, except that it's actually based upon MicroPython v1.23.0, plus a small fix to make our builds work.
If you're seeing hangs when you try to time.sleep()
or use led = Pin("LED", Pin.OUT)
or wireless functionality, then this is the release for you 🥳
Doing A Thing With USB
This release is based on MicroPython v1.23.0 (well, actually, just slightly past v1.23.0), which introduces USB support. We have not rolled this out to all of our builds because:
- It's new and complicated
- So we're still figuring it out...
- It's also big, and we're forever running out of firmware space
- And in many cases there's no good reason for USB... at least yet!
In lieu of this, you'll find a new build in this release: pico_usb
. This build gives you a way to play with USB on the Pico (non W for now) in conjunction with our libraries. To demo this we've added some basic code for long-time holdout Keybow 2040, which can now do keyboards things with MicroPython. You can find those here: https://github.com/pimoroni/pimoroni-pico/tree/main/micropython/examples/keybow2040
pico_usb
build uses a 1MB/1MB Flash/Filesystem split so it will erase your .py files. Back up before flashing!
What's Changed
To get an idea of what's new and what's improved, you should first read the MicroPython release notes: https://github.com/micropython/micropython/releases/tag/v1.23.0
Over here in Pimoroni Pico MicroPython land we've been busy fixing bugs and adding features-
Renamed And Less Breaky Builds
More of a personal bugbear than anything else, but I renamed our .uf2 files to drop the "pimoroni-" from the front so it's easier to scan-read down the list. I've also added a verification step to make sure we don't inadvertently produce totally broken builds- which has happened in a release at least once - or subtly broken builds - which has wasted inordinate amounts of my time spent scratching my head. If you want a tool/library to poke at Pico's binary metadata gooey innards, see: https://github.com/gadgetoid/py_decl
Updated ulab
Since we needed compatibility with some breaking changes in MicroPython v1.23.0, a bunch of extra fixes have been swept up in the ulab module. Details of the latest release can be found here: https://github.com/v923z/micropython-ulab/releases/tag/6.5.2
PNG Decode
We've added support for greyscale PNG files, which are a great way to stamp out monochrome icons from very, very small source files.
This support includes the ability to shift a greyscale PNGs "colours" to anywhere within a PicoGraphics palette. It's a hard concept to explain, but you can get two completely different recolours of artwork out of the same greyscale PNG file- @thirdr has illustrated this with an example: https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/pico_display/display_png_offset_palette.py
You'll also find basic PNG examples for Inky Frame, Pico Display and Tufty 2040 - https://github.com/pimoroni/pimoroni-pico/pull/928/files
All The Things 🎉
And here's an exhaustive list of everything we've merged since v1.22.2-
- PNGdec: Add greyscale support. by @Gadgetoid in #918
- README.md: Add link to pimoroni-pico-stubs. by @Gadgetoid in #910
- Added example for reading speeds from Inventor 2040W's encoders by @ZodiusInfuser in #923
- CI: Update actions to fix nodejs deprecation warnings. by @Gadgetoid in #925
- Fixed arg order bug by @thirdr in #929
- PNGdec: Add support for palette offsets and greyscale copy mode by @Gadgetoid in #919
- Slightly less frustrating MicroPython builds. by @Gadgetoid in #930
- LTR559: Add interrupt.py demo from #169. by @Gadgetoid in #909
- G/S/C Unicorn: Fix get_brightness to use correct max value. by @Gadgetoid in #911
- inky73: Add busy wait timeout. by @Gadgetoid in #920
- PicoDisplay: Fix misalignment on rotated Pico Displays (fixes #562.) by @Gadgetoid in #912
- Add support for 96x48 display to Interstate75 by @ConnorLinfoot in #867
- CI: Add py_decl verify step to catch binary overflows. by @Gadgetoid in #938
- Add PNG File subsection to Pico Graphics documentation by @coadkins in #939
- Add link to png by @exussum12 in #940
- Patch inky launcher by @thirdr in #942
- Examples/pngdec by @thirdr in #928
- Corrected pin definitions for OX and RED by @thirdr in #945
- Fixed button polarity by @thirdr in #944
- Fixed result status bug by @thirdr in #943
- CI: Scannable artifact and release names. by @Gadgetoid in #933
- AS7343: New driver for the 14 channel spectrometer by @Gadgetoid in #931
- i2s audio examples by @thirdr in #916
- Fixed background in SH1107 example by @thirdr in #946
- MicroPython v1.23.0 + USB-compatible Pico firmware. by @Gadgetoid in #915
- Docs: Fix .uf2 names, add pico_usb. by @Gadgetoid in #950
- TEST: Revert to v1.23.0. by @Gadgetoid in #952
Full Changelog: v1.23.0...v1.23.0-1
MicroPython Changelog: micropython/micropython@v1.22.2...v1.23.0
Note: also includes this commit: micropython/micropython@932f76c
New Contributors
- @ConnorLinfoot made their first contribution in #867
- @coadkins made their first contribution in #939
- @exussum12 made their first contribution in #940
Version 1.23.0
⚠️ Whoa There! ⚠️
I pulled in a few too many spicy, unstable post-1.23.0 commits and as a result, this release is broken. So very broken.
Please see: https://github.com/pimoroni/pimoroni-pico/releases/tag/v1.23.0-1
Doing A Thing With USB
This release is based on MicroPython v1.23.0 (well, actually, just slightly past v1.23.0), which introduces USB support. We have not rolled this out to all of our builds because:
- It's new and complicated
- So we're still figuring it out...
- It's also big, and we're forever running out of firmware space
- And in many cases there's no good reason for USB... at least yet!
In lieu of this, you'll find a new build in this release: pico_usb
. This build gives you a way to play with USB on the Pico (non W for now) in conjunction with our libraries. To demo this we've added some basic code for long-time holdout Keybow 2040, which can now do keyboards things with MicroPython. You can find those here: https://github.com/pimoroni/pimoroni-pico/tree/main/micropython/examples/keybow2040
What's Changed
To get an idea of what's new and what's improved, you should first read the MicroPython release notes: https://github.com/micropython/micropython/releases/tag/v1.23.0
Over here in Pimoroni Pico MicroPython land we've been busy fixing bugs and adding features-
Renamed And Less Breaky Builds
More of a personal bugbear than anything else, but I renamed our .uf2 files to drop the "pimoroni-" from the front so it's easier to scan-read down the list. I've also added a verification step to make sure we don't inadvertently produce totally broken builds- which has happened in a release at least once - or subtly broken builds - which has wasted inordinate amounts of my time spent scratching my head. If you want a tool/library to poke at Pico's binary metadata gooey innards, see: https://github.com/gadgetoid/py_decl
Updated ulab
Since we needed compatibility with some breaking changes in MicroPython v1.23.0, a bunch of extra fixes have been swept up in the ulab module. Details of the latest release can be found here: https://github.com/v923z/micropython-ulab/releases/tag/6.5.2
PNG Decode
We've added support for greyscale PNG files, which are a great way to stamp out monochrome icons from very, very small source files.
This support includes the ability to shift a greyscale PNGs "colours" to anywhere within a PicoGraphics palette. It's a hard concept to explain, but you can get two completely different recolours of artwork out of the same greyscale PNG file- @thirdr has illustrated this with an example: https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/pico_display/display_png_offset_palette.py
You'll also find basic PNG examples for Inky Frame, Pico Display and Tufty 2040 - https://github.com/pimoroni/pimoroni-pico/pull/928/files
All The Things 🎉
And here's an exhaustive list of everything we've merged since v1.22.2-
- PNGdec: Add greyscale support. by @Gadgetoid in #918
- README.md: Add link to pimoroni-pico-stubs. by @Gadgetoid in #910
- Added example for reading speeds from Inventor 2040W's encoders by @ZodiusInfuser in #923
- CI: Update actions to fix nodejs deprecation warnings. by @Gadgetoid in #925
- Fixed arg order bug by @thirdr in #929
- PNGdec: Add support for palette offsets and greyscale copy mode by @Gadgetoid in #919
- Slightly less frustrating MicroPython builds. by @Gadgetoid in #930
- LTR559: Add interrupt.py demo from #169. by @Gadgetoid in #909
- G/S/C Unicorn: Fix get_brightness to use correct max value. by @Gadgetoid in #911
- inky73: Add busy wait timeout. by @Gadgetoid in #920
- PicoDisplay: Fix misalignment on rotated Pico Displays (fixes #562.) by @Gadgetoid in #912
- Add support for 96x48 display to Interstate75 by @ConnorLinfoot in #867
- CI: Add py_decl verify step to catch binary overflows. by @Gadgetoid in #938
- Add PNG File subsection to Pico Graphics documentation by @coadkins in #939
- Add link to png by @exussum12 in #940
- Patch inky launcher by @thirdr in #942
- Examples/pngdec by @thirdr in #928
- Corrected pin definitions for OX and RED by @thirdr in #945
- Fixed button polarity by @thirdr in #944
- Fixed result status bug by @thirdr in #943
- CI: Scannable artifact and release names. by @Gadgetoid in #933
- AS7343: New driver for the 14 channel spectrometer by @Gadgetoid in #931
- i2s audio examples by @thirdr in #916
- Fixed background in SH1107 example by @thirdr in #946
- MicroPython v1.23.0 + USB-compatible Pico firmware. by @Gadgetoid in #915
Full Changelog: v1.22.2...v1.23.0
MicroPython Changelog: micropython/micropython@v1.22.2...932f76c
New Contributors
- @ConnorLinfoot made their first contribution in #867
- @coadkins made their first contribution in #939
- @exussum12 made their first contribution in #940
Version 1.22.2
Better... Later Than Neverer?
Hot on the tail of MicroPython v1.22.1 there was a patch release which included some changes to DMA interrupt handler behavior which we had to be a little cautious about embracing. It turns out that these did, in fact, expose some problems in the Hub75/Interstate75 driver which I have - hopefully - fixed. This release is mostly to track MicroPython v1.22.2, but includes a few downstream changes too.
For a complete list of MicroPython changes since v1.21.1, see micropython/micropython@v1.22.1...v1.22.2
This release also includes some fixes to PNGDEC (The PNG image decoder) to make it compatible with Badger 2040 / Inky Pack. This is useful, since PNG is a much, much better format for precisely plotting pixels on a 1-bit display.
Finally JPEGDEC gets a working width
and height
method which are usable after you open a file or stream, so you can determine the size of a JPEG before drawing it.
ULAB
ulab
- the lite, MicroPython version of numpy - can be found in the Cosmic Unicorn, Galactic Unicorn, Stellar Unicorn, Tufty 2040, Pico LiPo 4MB and Pico LiPo 16MB builds.
What's Changed
- Plasma Stick: add link by @helgibbons in #905
- JPEGDEC: Backport width/height changes from pngdec. by @Gadgetoid in #899
- Fixes for PNGDEC on Badger 2040 / Badger 2040 W by @Gadgetoid in #907
- CI: Bump MicroPython to v1.22.2. by @Gadgetoid in #904
Full Changelog: v1.22.1...v1.22.2
Version 1.22.1
Better Late Than Never
This release is - mostly - to track the latest v1.22.0 release of MicroPython and the v1.22.1 patch release, so you can start enjoying the fixes/changes.
For a complete list of MicroPython changes since v1.21.0, see micropython/micropython@v1.21.0...v1.22.1
Possible known issues:
- micropython/micropython#13380
- micropython/micropython#13377
⚠️ this release does not include patch release v1.22.2 - https://github.com/micropython/micropython/releases/tag/v1.22.2
What's Changed
- Pico Graphics: Avoid unecessary and broken polygon scanline clip. by @Gadgetoid in #862
- [Inky Frame] Fix news headline redirect example by @everyplace in #888
- [Plasma Stick 2040W] add Plasma LEDs link by @bitcdr in #886
- fix hue errors in plasma_stick_rainbows by @raybellis in #883
- Badger2040/2040W: Remove old/incompatible examples. by @Gadgetoid in #860
- fix: Only set time if the wlan is connected by @andrewjw in #813
- update picoscroll docs by @helgibbons in #876
- add adjustment for time zone offset by @pacohope in #877
- CI: Move some workflow steps into ci/micropython.sh by @Gadgetoid in #878
- CI: Bump MicroPython to v1.22.1. by @Gadgetoid in #892
- st7789: Remove mystery meat command implicated by #567. by @Gadgetoid in #898
- Add I2C pin definitions to motor2040 header by @robberwick in #890
New Contributors
- @everyplace made their first contribution in #888
- @bitcdr made their first contribution in #886
- @andrewjw made their first contribution in #813
- @pacohope made their first contribution in #877
- @robberwick made their first contribution in #890
Full Changelog: v1.21.0...v1.22.1
Version 1.21.0
MicroPython Made Me Do It
This release is - mostly - to track the latest v1.21.0 release of MicroPython, so you can start enjoying the fixes/changes
For a complete list of MicroPython changes since v1.20.6, see micropython/micropython@856e08b...v1.21.0
We have a couple of downstream fixes, too:
- JPEGDEC: If you supply bytes to
jpeg.open_RAM
it will now work as you might expect - sdcard: We've dropped our compiled
sdcard.mpy
in favour of including the micropython-lib sdcard.py
What's Changed
- Add I2C pins for PicoVision by @helgibbons in #852
- IOExpander: add I2C address change example by @helgibbons in #850
- JPEGDEC: Treat byte arrays as raw JPEG data for #435. by @Gadgetoid in #855
- CI: Bump MicroPython to v1.21.0. by @Gadgetoid in #858
Full Changelog: v1.20.6...v1.21.0
v1.20.6
(Slightly More) Glorious Vector Visuals
This release is mostly bugfixes for v1.20.5s vector graphics release.
There's also a bitmap font fix, making a space - in fixed_width mode - count as a fixed-width character, rather than the font's preconfigured space width.
What's Changed
- Tufty 2040: Vector examples. by @Gadgetoid in #837
- Fix clean Micropython build by @MichaelBell in #838
- Allow pen function for fast tile alpha blending by @MichaelBell in #839
- Initialize all matrix values by @MichaelBell in #841
- Fix newlines in rotated text by @MichaelBell in #842
- Improve pretty_poly performance by @MichaelBell in #840
- PicoVector - Fixes & Improvements by @Gadgetoid in #843
- Galactic: add links by @helgibbons in #844
- Bitmap Fonts: Fixed-width space for #765. by @Gadgetoid in #846
Full Changelog: v1.20.5...v1.20.6
Version 1.20.5
Glorious Vector Visuals
This release introduces a beta of PicoVector, a library that sits atop PicoGraphics and supplies anti-aliased vector drawing tools using Pretty Poly.
PicoVector is currently available in the following builds:
- Pico
- Pico W
- Pico LiPo
- Tufty 2040
It includes support for Alright Fonts, allowing you to convert almost any ttf or otf font into a simplified vector format - a sequence of overlapping polygonal contours - which you can use in your PicoGraphics projects.
And, we really mean almost any font -
Currently PicoVector is not fast. Turning off anti-aliasing gets you a little more performance, but it's generally only useful in very limited quantities.
What's Changed
- Add gfx pack carbon intensity bar graph example. by @simonprickett in #812
- Fix out of box failure when ARM toolchain is not in path by @Gadgetoid in #815
- Galactic Unicorn: add link by @helgibbons in #816
- PicoGraphics: Add Pico W Explorer SPI pins. by @Gadgetoid in #817
- stellar: correct paths to tiny font by @helgibbons in #822
- PicoVision: Minimal changes required to support PV specific drivers/pen types. by @Gadgetoid in #821
- Added some PicoGraphics based MP examples for the PicoUnicorn by @ahnlak in #830
- Cosmic Unicorn: add link by @helgibbons in #834
- Added includes to allow for libraries to be linked to out-of-tree by @ahnlak in #829
- PicoVector. by @Gadgetoid in #783
New Contributors
- @simonprickett made their first contribution in #812
Full Changelog: v1.20.4...v1.20.5
Version 1.20.4
Spin Me Right 'Round
Text bugs & rotation
In our continued quest to make doin'-text-stuff better, this version fixes a couple of text rendering bugs. The code wasn't taking into account letter spacing when calculating the width of words, resulting in auto word-wrap failing to wrap words that didn't fit. Additionally it was ignoring line breaks (\n
) so that manually wrapped text was rendered as one line. Both of these bugs should now bug fixed, and -
You can now rotate Bitmap text in 90 degree intervals. Just provide an angle
argument when drawing text
. Text is always drawn with the origin at the top-left, so a 180 degree rotation for text shown at 0, 0
will disappear the text off the left-edge of the screen. You'll need to offset your text accordingly to avoid this.
PNG support
Hands up, JPEG was an odd choice of format to start with for embedded graphics. It was grabbing JPEG files over the network and display them on e-ink displays that drove us towards it. Using it for icons in Badger/Badger 2040 was not a great fit- we had to be very careful to avoid JPEG artefacts resulting in spurious pixels. If only there was a better way-
There is! Microcontroller optimisation wizard @bitbank2 - the very same wizard who created the JPEG decoded we use - has a PNG decoder. This release adds that PNG decoder to our codebase and glues it into MicroPython for all your crisp, icon-drawing needs.
Like JPEG decoding, PNG decoding supports loading files from microSD, flash and RAM, but unlike JPEG decoding there are some new options for cropping, scaling and rotating you PNG images. (Note: the order is always crop, scale and rotate.)
A basic example looks something like this:
from pngdec import PNG
png = PNG(display)
png.open_file("fire.png")
png.decode(0, 0)
But say you have a spritesheet with 8x8 sprites and you want to display a 3x2 character from it at 4x scale, you might do something like this:
from pngdec import PNG
png = PNG(display)
png.open_file("/s4m_ur4i-pirate-characters.png")
png.decode(0, 0, source=(32, 48, 24, 16), scale=(4, 4), rotate=0)
The source
argument is the region, in pixels, you want to show from the PNG- offset left and top, plus width and height. The whole PNG is loaded and decoded no matter what you put here, but this makes it easier to manage multiple images for things like icons.
The scale
argument lets you scale images up by a fixed multiplier along the X and Y axis. If you want to make an image 4x wider and 2x taller you'd use scale=(4, 2)
.
Finally, rotate lets you rotate your PNG graphic in 90 degree intervals.
Both full-colour RGB PNGs and indexed ones are supported. For indexed PNGs - ie: one that has a palette - you can supply a mode
argument with one of PNG_COPY
, PNG_DITHER
and PNG_POSTERISE
.
PNG_COPY
will copy the palette indexes into a P4
or P8
graphics buffer rather than dithering or posterising (snapping to the nearest available colour).
PNG_DITHER
will use a simple ordered dither matrix to dither the image colours to the available display colours.
PNG_POSTERISE
will snap the colours in the PNG to their nearest display counterpart.
Posterise is the default in all cases.
What's Changed
- Document PicoGraphics fixed_width by @LionsPhil in #791
- SCD41: update examples by @helgibbons in #792
- Doc error in Pico Display Pack 2 README (C++) by @thinkier in #796
- Stellar: tidy examples by @helgibbons in #795
- Tiny 2040: add button/LED example by @helgibbons in #803
- PicoGraphics: Add support for PNG decoding. by @Gadgetoid in #802
- Add link by @helgibbons in #806
- Added light sensor example with auto brightness feature by @makosa-irvin in #807
- Added light sensor example to the cosmic and stellar unicorns by @makosa-irvin in #809
- Make Galactic clock example responsive by @North101 in #797
- CI: Fix linting issues. by @Gadgetoid in #810
- Support for text and PNG 90-degree rotations by @Gadgetoid in #811
- Enviro Pico description generation did not match f-string rounding by @awjlogan in #793
New Contributors
- @thinkier made their first contribution in #796
- @makosa-irvin made their first contribution in #807
- @North101 made their first contribution in #797
- @awjlogan made their first contribution in #793
Full Changelog: v1.20.3...v1.20.4
Version 1.20.3
Bluetooth
This release bumps the MicroPython version we're building against from 1.20
to 856e08b1931b88271816a2f60648f6ff332235b2
and includes various Bluetooth-related libraries into our build. Bluetooth support should be at feature parity with the official MicroPython release. Read more about it at https://www.raspberrypi.com/news/new-functionality-bluetooth-for-pico-w/
A Knowledge Of Font
Many of you expressed a desire to work with bitmap fonts outside of the rather uninspiring set we ship with PicoGraphics.
This has led to a couple of tweaks to PicoGraphics bitmap fonts. First up-
Fixed Width / Monospaced
All of out fonts conform to a fixed grid up to 16 pixels tall and - in theory - unlimited pixels wide. Within this grid, individual characters can have different widths which are computed when the font is generated and saved into the font data. This lets us calculate text widths really quickly and lets us squeeze characters up against each other to fit more on screen.
This is not, as it happens, ideal for displaying numbers. With "1" being narrower than "0", a real-time display of some variable could cause decimal places or larger numbers to jump erratically and be difficult to read. We've added a new fixed_width=
argument to text()
. Specify this when you draw text in MicroPython and all the characters will behave themselves and stay a fixed distance from each other.
How does it look? Well here's bitmap8
at 2x scale in both fixed and variable modes:
Custom Bitmap Fonts
Honestly, I don't know why I waited so long to make this happen. Our fonts are just data read from memory, and the code doesn't care if that memory is flash storage (built in fonts) or allocated by MicroPython (a bytearray in a .py file or a raw font loaded from user flash).
It's always been possible to use custom fonts in C, if you were determined enough to pick apart the font structure and painstakingly key in your own pixels.
And therein lies the problem. The biggest hurdle for users wanting custom fonts is preparing the font data. Our custom format is a little weird, mostly focusing on ASCII, plus some useful characters for - loosely - supporting languages other than British English and some even weirder diacritic mark support I glued on to sort-of support some unicode.
In typical fashion I decided to solve this "problem" by getting lost in a side project for viewing, editing and converting Pico Graphics fonts - pgfutil. It's extremely alpha, but you can find it here: https://github.com/gadgetoid/pgfutil
To load a custom bitmap font in PicoGraphics you just pass it into set_font()
. Eg:
display.set_font(open("font14.bitmapfont", "rb").read())
display.text("The quick brown fox jumps over the lazy dog", 10, 10, 240, 2)
An 8x8 font will cost you about 1k of RAM, and a 16x16 font around 3.6k. This is small compared to - for example - the 150k a 320x240 screen needs for 16-bit RGB but still big enough that you'll need to be careful how many fonts you use.
Font data is mutable, too. Do with that what you will 😆
Full Changelog: v1.20.2...v1.20.3
MicroPython changes: micropython/micropython@v1.20.0...856e08b