JSON error
markusmoenig opened this issue · 9 comments
Thanks for this! Has been a lifesaver.
There is a problem generating the JSON data, some chars are not strings but integers. XML always exports correctly. When creating JSON for OpenSans-Regular.ttf I get a chars like:
{"id":109,"index":80,"char":"m","width":36,"height":27,"xoffset":2,"yoffset":11,"xadvance":39,"chnl":15,"x":138,"y":0,"page":0},{"id":54,"index":25,"char":6,"width":24,"height":35,"xoffset":0,"yoffset":4,"xadvance":24,"chnl":15,"x":141,"y":115,"page":0}
Where the "m" is fine but the next character is 6 instead of "6".
This creates some headache with JSON decoders which are very type conscious, like the swift JSONDecoder.
Update: Only happens with characters 0-9. Looks like a failing type check.
Thanks
Thanks for the report. json
export is rarely used so not fully tested.
I'll look into it and probably fix in the next release.
Fixed via 4f8ab26
@markusmoenig Can you help to confirm whether this commit solve your problem?
@soimy Sorry for the late response. Just returned to this part of the project and no, the issue is not solved.
@soimy Just export a font to json and than search in the file for "char":0 which is wrong and should be "char":"0", the same as for all other digits. Easy to verify.
I'll try to reproduce that asap.
Can you give more info on that? eg: your cli parameters, your msdf-bmfont-xml
version etc.
Please update via npm i -g msdf-bmfont-xml
to test @markusmoenig
@soimy Just got back to work. Tested it and all good now, thanks a lot for the fast fix! Love this tool.
@soimy btw I added a link to your tool on my WebGL text stack overflow question / answer here: https://stackoverflow.com/questions/25956272/better-quality-text-in-webgl/35027166#35027166