Renders pixelfonts in micropython. Why do this? Pixelfonts are often more legible at small sizes than vector fonts. Also, you can add new fonts without modifying the firmware.
Copy writer_card10.py and any fonts to your app folder and import them. Fonts take a lot of RAM, so it's best not to use too many. Importing all the fonts in the demo at once will crash your app!
Use the TextBuffer and MultilineTextBuffer classes to render your text. Both of these internally handle FrameBuffers, so it's best to not make too many of these objects often.
TextBuffer displays a single line of text. It's perfect for sensor readouts and similar displays. It only rerenders the text if it changes, so putting it on the display is very fast otherwise.
MultilineTextBuffer is for displaying bigger amounts of text, like instructions or notifications. You can construct writers with different fonts and mix them, for creating bold text and similar effects.
If you want to encode your own fonts, take a look at the micropython-font-to-py repository. Be aware that you have to use the -x flag when encoding!
This project includes work done by other people, and released under permissive licenses. Specifically, these lovely people:
Dogica (released under SIL Open Font License)
Dogica bold (released under SIL Open Font License)
Peaberry Pixel Font (released under SIL Open Font License)
RaccoonSerif Pixel Font (released under SIL Open Font License)
Vote | Comment | Date |
---|---|---|
No votes yet :( | ||
File | Last edited | Size |
---|---|---|
writer_card10.py | 2022-01-03 10:48:49 | 12.52 KiB |