InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.64k stars 902 forks source link

Subpixel font rendering #1937

Open 0x0000ff opened 6 months ago

0x0000ff commented 6 months ago

I've enabled support for subpixel fonts in the lv_conf.h file and the generate.py script. The "subpixel" boolean option can be added to the options in the fonts.json file to generate subpixel fonts.

github-actions[bot] commented 6 months ago
Build size and comparison to main: Section Size Difference
text 370824B 1040B
data 940B 0B
bss 63516B 0B
0x0000ff commented 6 months ago

I thought I'd just add this as well for your future consideration.

I wanted to use this to get the text smaller whilst keeping it's readability, in order to get more test and more usable screen space.

I lowered the size of the main font to 15, with and without subpixels, and and there is a noticeable difference: InfiniSim_2023-12-16_110531 InfiniSim_2023-12-16_110707

I then lowered the font to 12, just to see what would happen, and the differences are more notable with this enabled: InfiniSim_2023-12-16_111309 InfiniSim_2023-12-16_111110

I also tried using a different font. I changed it to Open_Sans_light and put the size back to 15: InfiniSim_2023-12-25_125816 InfiniSim_2023-12-25_125901

The characters are very thin with it enabled, and they also don't seem to be vary visible in bright backgrounds: InfiniSim_2023-12-25_125811 InfiniSim_2023-12-25_125854

So I used the medium version of OpenSans, which made the text readable again: InfiniSim_2023-12-25_151240 InfiniSim_2023-12-25_151115 InfiniSim_2023-12-25_151512 InfiniSim_2023-12-25_141206

I flashed it onto my watch and I still find the text legible from arms length when I'm wearing it. 2023-12-25-15-37-20-402

0x0000ff commented 6 months ago

I should probably add a comparison between this and anti-aliasing at 2bpp InfiniSim_2023-12-31_114613InfiniSim_2023-12-31_114449InfiniSim_2023-12-31_123941

escoand commented 6 months ago

The first image looks much better, at least on my mobile display.

0x0000ff commented 6 months ago

You'll likely see vivid colour banding on the fonts on some screens due to the nature of subpixles and how a display's pixels are arranged. On the watch's screen it is rendered correctly.

This is using the subpixel font IMG_20231231_161706 ...And this is one with anti-aliasing 2023-12-31-16-20-30-068

They look similar to each other, but I think the subpixel fonts are more sharper and brighter. It does increase the filesize and has some colours banding, but I think it would be good for makeing small fonts legible.

kieranc commented 5 months ago

I like this, AA or similar for fonts has been something nice to have which we haven't had the space for for ages.

I'm wondering how much additional space it consumes, both vs current setup and vs 2bpp AA, and also how jarring it'll be if only some fonts are smoothed and others not?