Font issue with WebGL although I added the font

Sorry if this question has been asked. I looked through the forums and didn’t find it.

So here is my situation,

I am trying to use the arial font in unity in WebGL. The problem is that the unit default arial font does not work in unity. This is fine. I added the Arial.ttf font to my assets. This works as it uses the font and makes it look arial. However I am having to use some unicode coding to do subscripts and superscripts. This works fin in my editor or standalone versions but in WEBGL it doesn’t work. It simply replaces the unicode code with nothing. For example if I have CO2 with the 2 as a subscript it renders CO. I’ve uploaded a jpg so you can see what I’m dealing with.

I am having a hard time figuring it out.

Does anyone have any ideas?

Thanks
Darrell

3456480--274003--font.png

You’ll want to make sure you configure the font to use Unicode, not ‘Dynamic’ which is the default. What this does is generate a texture with all the possible font characters based on the font size you have configured.

The downside is if you’ve got wildly differing font sizes you’ll want to generate separate textures for them, otherwise they will stretch/shrink and become blurry etc…

4 Likes

OK. I have tried this but I"m still having problems. Now it appears that the new fonts I"m adding to my assets folder are not being used when I compile in webgl. Even though I have added them and changed the font on the text when I go to my program in webgl it reverts back to Arial. Again this only happens in webl. In my standalone projects it works just fine.

Hello, I was able to fix the same problem with @JJJohan solution. I added arial font in the projet and used this one with the unicode setting. Thanks everyone!

ThankYou so much!
Due to the fact that texts were not displayed in WebGL, I threw 2 projects into the trash. This time I found your advice and saved me.

I just want to say thank you for this. Your comment saved my project and it seems like you are the only one mentioned this solution on the forum