tips4design Posted August 13, 2015 Share Posted August 13, 2015 I want to use a Bitmap font on mobile devices, so instead of font.xml I use font.json My font is called font_main, here is the error:Phaser.Loader - bitmapfont[font_main]: Cannot read property 'info' of undefinedI load it like this: this.load.bitmapFont('font_main', 'res/fonts/font_main.png', 'res/fonts/font_main.json');If I use font_main.xml instead, it works. Why doesn't the JSON work? I converted it from the XML using font_converter.js node script posted here on the forums. Here is my JSON: http://codepaste.net/kujuxs It is not working on desktop. Link to comment Share on other sites More sharing options...
tips4design Posted August 13, 2015 Author Share Posted August 13, 2015 Ok, I fixed it (by looking through Phaser jsonBitmapFont source). The properties for the JSON object have to be in a different format:All (most of them) properties are prefixed with underline _ The root is an Object called 'font' Characters are inside {chars:char[]} array (not directly in char as in the XML) Link to comment Share on other sites More sharing options...
Toknos Posted January 21, 2016 Share Posted January 21, 2016 Hey, could you share your json? I get the same error, but I can't understand your explanation :/ Also, this has changed with the latest version of phaser right? Swear the same fonts worked a year ago Link to comment Share on other sites More sharing options...
Toknos Posted January 21, 2016 Share Posted January 21, 2016 Huh. The new Cocoon app seams to handle xml fine, I guess I'll just stick with that then! Link to comment Share on other sites More sharing options...
Recommended Posts