Dynamic Text Font Name Detection Issue in Android Vs Windows

Load this on an Android phone, then on a Windows desktop using latest Chrome or Firefox.

https://playground.babylonjs.com/#5ZCGRM#2040

It looks like if you use a font with a space in the name for a dynamic texture, such as Encode Sans, Android devices seem to accept it fine and load the correct font, but a Windows machine will fail to load and instead will use the default dynamic texture font.

Note, Encode Sans is a Google Font, I could not add it to the playground directly due to permissions. But once its in your cache its there until you clear it. So punch onto my development domain http://dern.tech and it should cache for your testing needs. Ill remove that link in a day or so once this bug gets logged, as not much to see ATM, I am just getting started on messing around with labels. Or, pick any other font with a space in the name.

make sure that the font had been loaded before drawing text…

use

or

:beers:

1 Like

It is

document.fonts.ready seems to work! I found a (probably hacky :rofl: ) way of adding a Google font to the playground, and I got the same results on Windows and Android :smiley: However, you have to press play to load the font, since it’s added during the run.

https://playground.babylonjs.com/#5ZCGRM#2041

Edit: Since the spacing on the name of the font was mentioned, I realized I probably should have tried with a font like that too. Again, have to press play for it to load, but it is displayed then:
https://playground.babylonjs.com/#5ZCGRM#2042

3 Likes

@carolhmj I think I might have figured out a solution to having to press the play button multiple times.

I tried using some try/catches and set time outs (line 46) in order to wait for it to fully load. :slight_smile: https://playground.babylonjs.com/#5ZCGRM#2052

Got some help from this thread too if anyone wants an extra read.

2 Likes

Woah, AWESOME!

2 Likes