SetArraySizes() - Null Character Crash

Hi,

I have a missing character in my font that I am expecting to render using the space character of my global fallback. Instead line 1253 of TMPro_UGUI_private is causing a crash.

Taking a quick look at the source code, I think the issue is that the call made to GetCharacterFromFontAsset() to get the space character is only looking at the fallback font set on the current font asset whereas it should also be looking at the global fallback font.

I have hit this issue as I strip all the characters from my main English font from all my foreign fonts and rely on the fallback rendering to render any Latin characters. For now I can work around this by ensuring all my main font assets have the space character included (which would probably be a good idea anyway from a performance perspective, only use the fallback font when it is really necessary).

Thanks,

Niall

Since the space character metrics differ between font files and given it should be present in all font files, I would recommend making sure it exists in all your font assets. Since it doesn’t take any texture space either, there is no downside to including it.

Having said that, I’ll think about revising the logic to make sure it can be found an all potential fallbacks.

1 Like

Thanks @Stephan_B for the useful explanation. Have added the space character too all my font assets now.

I also realised that in the TMP Settings the “Dynamic Font System Settings” affect all font assets. From the name, I thought this would just affect dynamic mode font assets. I used this to change the Missing Character Unicode to something my base font included and this also stopped the crash happening as it no longer needed the space character.