Extra chars not displayed in font preview but they render fine (solved)

Now, this is just a question out of sheer curiosity:

I’ve added a bunch of extra characters to my font files:
Screenshot 2022-07-06 at 12.07.33

Some are not displayed in the preview:
Screenshot 2022-07-06 at 12.08.11

So, I was a bit puzzled, but they render just fine:
Screenshot 2022-07-06 at 12.14.45

Same goes for many other characters. Ticking “all chars” doesn’t show them either. Mind you, the font in question has almost 2000 glyphs.
So, my question: is there a reason as to why these glyphs don’t show up in the preview, and if so, is there a way around it?

I don’t know to be honest. Perhaps @vlaaad knows?

1 Like

What, you don’t know this? :grinning_face_with_smiling_eyes: That’s ok, I am just very curious, as usual. As long as the glyphs render, all is good. I first thought there is something wrong with my .ttf when the glyphs didn’t show up.

1 Like

Found the answer: because the initial implementation (from 2015!) was made to show only characters in the range [0,255) in the preview.

3 Likes

Ah, that’s it. Thank you very much, Vlad, for having a look :smiley:

Some more context: it seems there is a limitation to using 1024x2048 texture for fonts in the editor. This decision to limit the number of displayed characters to the 0-255 range is a workaround to ensure we show glyphs when we e.g. chose a font with too many characters and selected “Use All Chars”. You can still trigger this limitation that will result in no preview at all if you select a very big font size.

1 Like

Ah, yes, I’ve had these situations already. Now I know why these really large chars don’t display.

This makes sense!

Thank you very much for taking your time to answer my question.

I just merged a change to defold editor that addresses your question/concern — we will try to show as many characters as possible from now on. Update should be out soon.

5 Likes

Now, that’s really super. Thank you very much :partying_face:

Edit:

Just arrived, now that was reeeeeeally soon :grinning_face_with_smiling_eyes: You folks are great! All here:
Screenshot 2022-07-06 at 18.34.45

2 Likes