trip5 / Matrix-Fonts

Fonts For Use with LED Matrix Clocks
MIT License
30 stars 3 forks source link

[Issue] TTFs aren't working #6

Closed lubeda closed 9 months ago

lubeda commented 9 months ago

Information

Hi, besides the positive vibes, i found an issue.

On compiling the latest EspHoMaTriX with your TTFs i got this error: ERROR Could not load truetype file /config/esphome/MatrixChunky8.ttf: invalid pixel size

font:
  - file: MatrixChunky8.ttf
    id: default_font
    size: 8
    glyphs:  |
      ! "#$%&'()€*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°

In the windows TTF viewer, they are all white

image

Relevant log output

No response

trip5 commented 9 months ago

Windows font viewer can't see anything because there are no outlines. The only way to allow previews is to run it through some rasterization or something which would increase the file size which would create outlines but... with unpredictable results.

I'm not sure what your issue is... I even cleaned my build files, tested with your exact yaml extract, and made sure I was using the latest version of my fonts but I had no issue compiling. Are you sure you've got the most recent TTF and you're referring to the right location? That error is usually from referencing the wrong font size / the size is unavailable in the TTF file. Is it possible your renamed 6 to 8?

The size: 8 part is mandatory for these TTF files. Are you sure it's there? Check for some invisible characters that may be causing problems...?

lubeda commented 9 months ago

This works, the size: must match the height of the font.

  - file: MatrixChunky8.ttf
    id: default_font
    glyphs:  |
      ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
    size: 8
  - file: MatrixChunky6.ttf
    id: special_font
    size: 6
    glyphs:  |
      ! "#$%&'()*€+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°