How to make sure that all fonts are loaded before to start BABYLON.js?

Please don’t use domain expert’s abbreviations, took me 30min to find out that you mean adt = AdvancedDynamicTextures ^^.

So here is the solution I came up with, using FontFaceObserver:

async load(){
        //   @import url('https://fonts.googleapis.com/css?family=Kalam|Mali:400,700|Patrick+Hand');
        await Promise.all([
            new FontFaceObserver('Mali', {weight: 400}).load(),
            new FontFaceObserver('Mali', {weight: 700}).load(),
            new FontFaceObserver('Kalam').load(),
            new FontFaceObserver('Patrick Hand').load()
          ]).then(() => {
            console.log('Output Sans family has loaded.');
          });
    }

Then I create my menu.

I tried without the await and adding this.UIRoot.markAsDirty(); in the .then() but that did not work: one of the text was not updated!

2 Likes