lvgl / lv_font_conv

Converts TTF/WOFF fonts to compact bitmap format
https://lvgl.io/tools/fontconverter
MIT License
172 stars 77 forks source link

Bitmap font (pcf and/or bdf format) #114

Open razor5k opened 3 months ago

razor5k commented 3 months ago

Hi, I've a display which has a resolution of 256x64 Pixel (SSD1322 controller) and I need also small font sizes (8px and so on). But every rendered font don't look very pretty. Is it possible to edit a font after rendering (with a font editor tool from lvgl or something) or can I use bitmap fonts such as pcf or bdf format? Does lv_font_conv handle bitmap information embedded in ttf or otf etc? If I disable autohinting, the font seems to look better but I thought hinting should make the font better look.

kisvegabor commented 2 months ago

Unfortunately there is no easy way to edit the generated fonts.

For monochrome displays I think the best you can do is selecting a pixel font. The Terminus font might be a good first candidate.

Alternatively you can try Image font.

razor5k commented 2 months ago

Thx. I tested Terminus and it looks very pretty. It's a mono space font and it looks very 'sharp'. I also found a way to "convert" a bdf to a ttf. Binary information of the bdf files will be embedded to a single ttf file by using 'mkttf'. It uses fontforge, imagemagick and potrace. Now I'm able to use every bdf font. It would be nice if lvgl_font_converter could use the bdf format as well. Because the pixel information is directly available, no complicated rendering would be necessary. But mkttf works for me as well :)

kisvegabor commented 2 months ago

The font converter uses FreeType, so we can use the font types supported by FreeType.

Would you be interested in documenting the process of bdf to ttf conversation? If so I think a section after this would be quite useful for others. (You need to edit this file to update the docs)

razor5k commented 2 months ago

Yes, I will document the use of the BDF files in the next few days.

kisvegabor commented 2 months ago

Great, thank you!