Repository navigation
Replies: 1 comment
Yes, this happens because a bitmap font is being used which won't scale nicely since it's fixed-sized. On the other hand, you have control over how each pixel is rendered which was important for a small display like M5StickV. I tried to pick the smallest, clearest font I could that also had support for as many unicode characters as possible and ended up having to combine the Terminus font with the Fairfax font to do this, hence the various scripts you'll see in the If we want to support different size fonts depending on the device, I think that should be baked into the build process somehow so that only the bitmap font data necessary for a particular device is loaded. Otherwise, I think it will take up too much memory storing all the different size fonts and their glyphs in the firmware. Then, we could just get the font size from the board config for rendering calculations.
Yes and no. The Terminus font is an 8x14 font (no padding), but the Fairfax font is 6x12, so padding has been added to make it act like an 8x14. The glyphs from both fonts were combined to make one super font to support most unicode characters. This gets to your next question... the
Sounds good! This would definitely be better and more accurate. Then eventually when more font sizes are added, we could pull this from the board config like I mentioned above. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Size
Hi, I'm doing some experiments with larger fonts and have some questions:
For now what I can do is use
imagemodule andscaleattribute ondraw_stringto make texts larger. But the font gets ugly with low resolution.Do you know a better way? Are the scripts in
firmware/fontfolder used to create the font?Font uses 6x10 pixels to draw on, and 2px for x_padding and 4px for y_padding, making it 8x14 pixels, am I right?
Padding
In display.py I noticed several functions have padding attribute, but no one uses it, except the were
x_offsetis calculated, there padding modifies the result. But I think this calc could be modified:The real
font_sizeis 8px (the code uses 7px now) if 8px is used in the calc the padding variable can be removed and text will get correctly centralized.I also think the
font_sizecould be replaced byfont_width, andline_height()could be a constant(14) which is the real font height.I am already working with this modifications in order to make port for other boards/displays cleaner, if you think it is a good option I can make a PR on it.
All reactions