InfiniTimeOrg / InfiniTime

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

Replace the Mono font with something a little nicer #955

Open jmaris opened 2 years ago

jmaris commented 2 years ago

Verification

Pitch us your idea!

PinetimeLite has a Nice Sans Serif font, could we do the same?

Description

No response

JF002 commented 2 years ago

Do you have a link to such font (preferably one with a license that allow us to use it in an open source project) ?

ainola commented 2 years ago

There are many such compatible fonts! :)

Perhaps this list would help: https://wiki.archlinux.org/title/Fonts#Latin_script

You can't go wrong with the Liberation family. Cantarell is used by gnome. Noto is a fan favorite. Lato is a personal one.

geekbozu commented 2 years ago

This would be a good test for the filesystem as well. I wonder how painful loading a font from the FS would be. If its not exceptionally slow it might be worth writing it to external flash in the next update so we can strip it from the rom in the future! (and if it is slow maybe revisiting LVGLs implementation for sleep Or a different FS system)

Riksu9000 commented 2 years ago

I did some testing. I found that the optimal thickness for a non antialiased font is 2 pixels. The current font is about 2-3 pixels and a font with a thickness of a single pixel is too thin to use in some cases. Ideally we would have multiple weights, or at least a regular and a monospaced font. Unfortunately, unless I made a mistake, it seems that a non monospaced font uses ~3700 more bytes due to kerning I suppose.

This is Roboto Medium. These screenshots are a bit blurry, but in reality this looks very nice and sharp. Here we can see another issue however. The font conversion isn't pixel perfect. If we look at the word InfiniTime, we can see that there is a larger gap between i and T than T and i. There are many more cases like this where the spacing isn't as expected.

We need to find a font that is the optimal thickness, preferrably with multiple weights, and looks good at very small sizes. I don't know if the spacing issue is due to the font or the LVGL converter, but it should be taken into consideration.

license settings watchface

ainola commented 2 years ago

Size was something I was a little concerned about. These look super good though! Much more readable.

JF002 commented 2 years ago

Yes, I think it looks good, but as you say, the spacing looks inconsistent. The word "format" on the 2nd screenshot look like "forma t" with a space before the 't'.

medeyko commented 2 years ago

I think that Jetbrains mono font is more stylish. It's a very nice font, I like it is used in PineTime, I'd prefer it not to be removed.

Also variable width font should not be used on watch faces and in most apps, to ensure that the position of characters is constant. It is especially important for dynamically changing texts.

Variable width fonts should be used only for non-position-dependent static relatively long texts only, like on the images above, I think.

Also I believe that variable width font inevitable requires more hardware resources, both memory and CPU.

ainola commented 2 years ago

On 2022-02-06 22:05, medeyko wrote:

Also I believe that variable-length font inevitable requires more hardware resources, both memory and CPU.

I'd be interested in getting some benchmarks because this makes me think of the "SSL takes more hardware resources" that may have been valid on older hardware but perhaps is not the case nowadays.

But that is true that it would cause more maintenance to ensure proper kerning, etc.

Avamander commented 2 years ago

because this makes me think of the "SSL takes more hardware resources" that may have been valid on older hardware but perhaps is not the case nowadays.

It is valid even in this day and age, just the impact is reduced in any usual use-case. However, in the context of embedded devices, TLS is very expensive.

Proper typesetting is certainly more expensive than simply using monospaced fonts. You can probably sacrifice some correctness for less cost, but it will probably annoy people. Probably inevitable for some non-latin scripts and that would be the only context I'd support the inclusion in.

jarinox commented 1 year ago

Yes, I think it looks good, but as you say, the spacing looks inconsistent. The word "format" on the 2nd screenshot look like "forma t" with a space before the 't'.

Even with this inconsistency I think the proposed font looks much nicer than the current monospace font. To me a more beautiful user interface and especially watch face is much more important than always having a perfectly consistent spacing.