KnTproject Posted September 25, 2016 Share Posted September 25, 2016 Hello, I would like to add Google Web fonts to my Phaser projects. I saw many topics about it, but I can't find a solution. Can anybody tell me in easy steps how to add a google web font to my phaser project? Thanks! Link to comment Share on other sites More sharing options...
drhayes Posted September 26, 2016 Share Posted September 26, 2016 Here's an example that uses a Google web font: http://phaser.io/examples/v2/text/google-webfonts Link to comment Share on other sites More sharing options...
KnTproject Posted September 26, 2016 Author Share Posted September 26, 2016 6 hours ago, drhayes said: Here's an example that uses a Google web font: http://phaser.io/examples/v2/text/google-webfonts Thank you for you response. I have already seen that example, but I don't understand it. Can you please tell me in little steps how to use a google font? Link to comment Share on other sites More sharing options...
drhayes Posted September 27, 2016 Share Posted September 27, 2016 Assuming you've loaded the font in the loader (line 21)... the Google web font loader looks for a global object called "WebFontConfig". One of the properties of that object is a method called "active". The Google font loader will call that method if you've defined it. What this particular "active" does is wait one second (i.e. game.time.events.add(Phaser.Timer.SECOND, ...);) and then call the method "createText". AFAIK, it's that one second wait that's key. Without it the fonts won't display when used in your game. Befive.Info 1 Link to comment Share on other sites More sharing options...
Recommended Posts