Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character not being rendered correctly even it's in the font #189

Open
Alex-joomla opened this issue Dec 28, 2023 · 4 comments
Open

Character not being rendered correctly even it's in the font #189

Alex-joomla opened this issue Dec 28, 2023 · 4 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Alex-joomla
Copy link

Alex-joomla commented Dec 28, 2023

Question

I call a service node in node red to add a Icon_screen:

{
    "icon_name": "dishwasher",
    "text": "{{payload}}",
    "lifetime": "1",
    "screen_time": "1",
    "r": 255,
    "g": 255,
    "b": 255,
    "default_font": true
}

payload is this: "Geschirrspüler: finished / noch 0 Minuten"

But what I get are two big white blocks with a x2F in the middle instead of the Dash. The Dash is a Glyph, i know, but it's availible in my font:

font:
  - file: CalciumThin.ttf
    id: default_font
    size: 16
    glyphs:  |
      !?"%‰()+*=,'-_.:°µ²³0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz€$@<>/
  • used Hardware:
    • Ulanzi PixelClock

    • EspHoMaTriXv2, newest

Logs

Additional context

@Alex-joomla Alex-joomla added help wanted Extra attention is needed question Further information is requested labels Dec 28, 2023
@trip5
Copy link
Contributor

trip5 commented Dec 28, 2023

This likely isn't an issue with ehmtx. Like the dash being used in the payload isn't the same as the hyphen-dash you're including in the glyphs section. Node red may be giving you an em dash or en dash...?

Edit: sorry I was working from my phone and I didn't realize that is a slash... but still, this isn't an ehtmx problem. It's a character-encoding problem.

I'm pretty sure the payload is including CR or LF characters which are not going to be interpreted well by anything in mqtt... I don't have experience with Node red but perhaps you can copy and paste the entire payload into Notepad++ and view hidden characters and see if I'm right...

Another solution is to try to move the punctuation in the encoding a bit, sandwiching it between known "good" characters because maybe ESPHome is interpreting the string badly... try this:

!?"%‰()+*=,'-_.:°µ²³0123456789€$@<>/ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz

If that doesn't work, try using the font in my own repo to test another font. I'm sure mine does have those characters. Too many fonts are missing punctuation characters...

Please do return to this thread with an update if you can/can't fix the issue.

@Alex-joomla
Copy link
Author

Thank you for your hints. Interesting thing is: if I feed the glyph into the call service node via a flow it gets rendered incoreectly. But if I type it directly in the call service node, it works.
Wont work:
Bildschirmfoto 2023-12-28 um 18 49 27

Works:
Bildschirmfoto 2023-12-28 um 18 51 41

Should I take it to a NodeRed Forum?

@trip5
Copy link
Contributor

trip5 commented Dec 28, 2023

Probably? I've somehow missed adding Nodered to my setup.

It's a bit weird... 2F is clearly the code for the solidus slash... but the blocks around it are unprintable characters / characters not available in the font (they could be anything, even a 00 null character)... you should probably find out what those are...

Try viewing the payload through Home Assistant in developer services and copying and pasting into Notepad++ as I said. You'll have a better idea of what exactly the problem is.

Addition: You might be able to do a character filter either through Home Assistant or the folks in Nodered forums might be able to help.

@trip5
Copy link
Contributor

trip5 commented Aug 18, 2024

Did you ever work this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants