Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.79k stars 1.09k forks source link

White space is way too small for monospaced font #2533

Closed rebior closed 1 year ago

rebior commented 1 year ago
  1. Description I created vlw font files from the font "Noto Sans Mono" on Linux. The space character is excluded as mentioned in the guide. I use drawString to put smooth text on the screen and all characters have equal width except for space characters, that are way smaller.

  2. IDE: PlatformIO/Arduino

  3. TFT_eSPI library version: 2.5.0

  4. Board package esp32dev (cant't find exact version)

  5. Procesor ESP32

  6. TFT driver ST7735_BLACKTAB

  7. Interface type SPI

The following screenshot shows the two strings "HOST: " and " IP: ", both left aligned at the same x position. I would expect for the colons to be vertically aligned (which is the case if there are only characters other than space) Screenshot

I can also provide a vlw file if it helps.

Bodmer commented 1 year ago

The vlw files don't specify a space with, so this is guessed from the font height here: https://github.com/Bodmer/TFT_eSPI/blob/master/Extensions/Smooth_font.cpp#L139

In your use case gxadvance would probably work.

rebior commented 1 year ago

In your use case gxadvance would probably work.

This means I should set that value manually after loading the font?

Bodmer commented 1 year ago

Yes.

rebior commented 1 year ago

The pull request (#2540) provides a simple and backwards compatible solution for that issue. I tested it in my setup and the alignment is perfect. Some details: I added an additional enumeration argument to the loadFont methods with default value set to current behavior. With this enum the user can select how the space width is computed.