zst-embedded / STM32-LCD_Font_Generator

Generate text font for STM32xx-EVAL's LCD driver
GNU Affero General Public License v3.0
37 stars 21 forks source link

Spacing between letters #4

Open JamesMacLean opened 1 year ago

JamesMacLean commented 1 year ago

Hello. Thank you for creating this very useful script.

I am finding that the fonts that I create using the font generator have a wide spacing in between letters. Is there any way I can make the font narrower?

This picture shows an epaper display with the Futura 32pt font and the Menlo 32pt font that you provide as an example. The menlo font has much less blank space between letters.

20230130_185353

In the file for the font it shows that the Menlo font is only 20 pixels wide per letter image

While the new Futura font I created is 32 pixels wide per letter image

How can I fix this? Thanks

edit: I am using font files from https://ttfonts.net/

zst123 commented 1 year ago

Hi, the script should automatically detects the width of the font using the function get_max_width(...). Perhaps for this font, it did not detect it correctly.

To workaround, you may modify this line and set font_width to your own, for example font_width = 21.

thanhtam92 commented 8 months ago

I got same issue when trying with other fonts, eg: Inter font and solved The cause of issue is the font has some characters with a larger width, e.g., W, @, M, m, while others are very small. My idea: