InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Subpixel font rendering

Open 0x0000ff opened this issue 2 years ago • 6 comments

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.

0x0000ff avatar Dec 25 '23 14:12 0x0000ff

Build size and comparison to main:

Section Size Difference
text 370824B 1040B
data 940B 0B
bss 63516B 0B

github-actions[bot] avatar Dec 25 '23 14:12 github-actions[bot]

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 avatar Dec 25 '23 15:12 0x0000ff

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

0x0000ff avatar Dec 31 '23 12:12 0x0000ff

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

escoand avatar Dec 31 '23 12:12 escoand

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.

0x0000ff avatar Dec 31 '23 16:12 0x0000ff

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?

kieranc avatar Jan 14 '24 21:01 kieranc