Thanks for the reply! So, when the font is embedded via the style tag in index.html (and the files moved into bin/), is this all the link-age that happens? In other words does the load() call do anything for font files, or is the browser handling this autonomously? Also, is it recommended to provide all font types (eot, woff, svg, otf)? I see all the warnings in console. If I provide any otf files, the project fails to compile.
So with only TTFs provided, it all works okay when not on Android. On Android, I can trace out that the load callback only finishes my image and sound file, and never any fonts. So I only ever end up seeing my trace (“loaded 2/5 assets”) from Preloader:update(), then it will hang indefinitely. Now if I check the same trace in another (working) browser, I see it get to “5/5” and then trace out from the Preloader:start() function.
Here’s some additional info for my process:
using openfl 2.1.7 (but same results previous versions).
application.xml:
<!-- assets -->
<assets path="assets/img" rename="img" type="image" />
<assets path="assets/fnt" rename="fnt" type="font" />
<assets path="assets/snd" rename="snd" type="sound" />
Then, in my assets directory I have:
- img/myImage.png
- fnt/myFirstFont.ttf
- fnt/myFirstFont-bold.ttf
- fnt/mySecondFont.ttf
- snd/mySound.ogg
Then in my source code, I just have someText.defaultTextFormat = new TextFormat( “myFirstFontName” );
When I hit that line, I get no font for about <1 second, then all the fonts automatically render and work. (this sounds like what you were describing).
That’s it. As far as (pre)loading goes, it’s just using clean openfl and I haven’t done anything before the game starts, which won’t happen on my Android device. So if there is something else we should be doing or if there are more tests you’d like me to try, happy to help!
Thanks for your hard work in openfl!
UPDATE: So it seems you can get around the load stalling issues for both audio and fonts by telling your libraries to not preload by turning embedding off. Fonts and audio still work in all web browsers without changing any code. For now, this is a decent approach anyway because you typically don’t want to pre-load all your audio.
application.xml:
<assets path="assets/fnt" rename="fnt" embed="false" />
<assets path="assets/snd" rename="snd" embed="false" />
Not the end-all solution, but okay for now if you are stuck with this problem until a proper fix is implemented.