Changes found on new font converter

Hi,

I will use this post to comment the differences I’m finding related to font drawing once upgrade to v6.0 and new font converter.

The first thing I have found is about font size. I have used Freesans_18 for both v5.3 and v6.0 resulting a bigger font with this last update.

Header with LittlevGL v5.3 (old font converter)

3

Header with LittlevGL v6.0 (new font converter)

0

Header difference

test_diff

Did you know this was happening? Maybe there should be an advice within the documentation or within the release notes.

I can think of a couple things off the top of my head:

  • Font sizes might be interpreted slightly differently by the new font convertor. You can probably rectify that by converting with a slightly smaller size.
  • Kerning is now enabled, which will affect the spacing of the characters. The switch to disable kerning is present in the code but I’m not sure if it is brought out to the HTML.
  • More information about character positions is stored than before, which (again) will affect the rendering.

Thanks for so quick answer ;).

I am on the way of trying to understand new font converter and the way now LittlevGL paints a character.

Anyway, a part from all the changes and the new paradigma, I think this should be noted down somewhere.

I finally think I have the size which matches the previous size of 18. The new size may be 14, I checked quickly and besides the parameter:

.line_height = 18,          /*The maximum line height required by the font*/

Nevertheless, I see worse resolution/convertion on the new font encoder:

Old converter (freesans18, 2bpp)

3

New converter (freesans14, 2bpp)

3

Some differences in characters

This could be seen better opening above images with GIMP for example.

Old converter left ------- New converter right

It seems silly, but you can really notice it when watching on the screen.

Did you mix up the first two pictures? To me the new convertor looks better:

@embeddedt It seems the forum was quoted the wrong image. The second has large characters while in the original post the characters’ height are the same.

Anyway, it’s absolutely possible that the sizes has been changed.
In the old version if you set 18px height the converter adjusted the size internally to fit into a 18 px tall box.
However, in typography the meaning of font size it’s quite complex. If you set 18 px height it doesn’t include all ascents and descents. The new converter uses this more common but more complex approach. So now the fonts will have the same size as on PC in text editors but (usually) will be larger than the height you specify.

Regarding the quality, I think it’s an unlucky case. Could you try a 15px font? Probably the size won’t change much but hopefully, the extra pixel is enough to solve the quality issue.

I understand more or less the new approach, thanks.

Regarding the quality, it seems we have lost some, at least for this case. See, I have done some tests to display the same string for different sizes:

3_cropped Freesans18 v5.3
0_cropped Freesans16 v6.0
0_cropped Freesans15 v6.0
0_cropped Freesans14 v6.0
0_cropped Freesans13 v6.0

In general, if we compare character by character, font converter v5.3 obtained much better results. For example, looking the underscore glyph ‘_’, it’s curious that it is not rendered as full color in most of the cases.

It seems that Freesans16 v6.0 is the one which looks better, although the size is bigger (not acceptable in my case). Besides, many characters add soft sourrunding pixels making glyphs widder.

I know it may be an special case for this configuration, but is there any possibility to use the old bitmaps with new approach?

It’s a usefule article to learn more about font metrics if you are interested:

It seems possible but:

  • some interface functions needs to be written
  • the generated fonts needed to be modified manually.

I suggest opening an issue in the lv_font_conv repo and ask Puzrin. (he has written the new converter) Probably he can tell more about it.

Really useful to get first contact with Font’s World (need to read slowly).

Done here.

I have to more questions about fonts:

  • How can I choose the number of pixels for a space glyph?
  • How can I choose the number of pixels between any two consecutive glyphs?

You can adjust the adv_w parameter of “space” (upscaled by 16)

Use style.text.letter_space

That’s great!

Hopefully I will be able to test all the font stuff in a few weeks.

Thanks :wink:

I am in the same boat with fonts under 6.0. My display is 240x320 with no antialiasing, and the font I used in 5.3 looks horrible under 6.0, even adjusted to get it to the same size.

I am using Pixellari (pixellari at 16px (at 5.3 size)

Here is a photo of 5.3 version on the display:

Here is the 6.0 version on the display (please disregard color differences):

We are planning to switch a component of the font converter back to the one that was used in 5.3 and prior versions. That will hopefully fix the majority of the issues that users are seeing with fonts in 6.0.

1 Like

Has this been change been made yet?

I tried the online converter again and it still does a really poor job on non aliased fonts (compared to 5.3)

Here is a screenshot from the simulator, even using a very large font size for the conversion, it’s not good. The original font is in the background.

TFT_Simulator

I tried using the CLI converter and seem to get better results, at least for sizes down to 16:

this is with the command:
lv_font_conv --font Pixellari.ttf -r 0x20-0x7F --size 16 --format lvgl --bpp 1 --autohint-off -o ./pixellari_6_test_cli.c

I believe that the online font converter has not been updated (and probably won’t be until 6.1 is released). You will have to use the offline one to get the fix.

1 Like

Yes, that was my plan.