Hsaka Posted October 31, 2013 Share Posted October 31, 2013 I've been having some issues with using BitmapText with my game, Sky Legend on Firefox. All is fine if I replace BitmapText with normal Text objects, but when rendering some BitmapText objects, Firefox gives this error:IndexSizeError: Index or size is negative or greater than the allowed amount On line 34124 in Phaser.js:if(displayObject instanceof PIXI.Sprite){ var frame = displayObject.texture.frame; if(frame) { context.globalAlpha = displayObject.worldAlpha; if (displayObject.texture.trimmed) { context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2] + displayObject.texture.trim.x, transform[5] + displayObject.texture.trim.y); } else { context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]); } context.drawImage(displayObject.texture.baseTexture.source, frame.x, frame.y, frame.width, frame.height, (displayObject.anchor.x) * -frame.width, (displayObject.anchor.y) * -frame.height, frame.width, frame.height); } }It appears that this error is caused when frame.height is zero. At no time do I set a BitmapText object's height to be zero.This error only occurs in Firefox. Link to comment Share on other sites More sharing options...
rich Posted October 31, 2013 Share Posted October 31, 2013 This is related to one of two things, either the bug I fixed earlier today (now in dev branch) about the XML data being seen as strings, not integers, OR its because the Bitmap Texts XML file is encoded with something other than UTF8. If it's UTF16 for example then Firefox won't parse it. Check that first as it could be all you need to do. Link to comment Share on other sites More sharing options...
plicatibu Posted October 31, 2013 Share Posted October 31, 2013 Let me say that my code worked fine with version 1.1 but shows the same error reported by Hsaka in Phaser 1.1.1.Regards. Link to comment Share on other sites More sharing options...
Hsaka Posted October 31, 2013 Author Share Posted October 31, 2013 Thanks for the quick response Rich. I tried using the latest dev version and making sure the file is UTF8. I still see the same error in Firefox. Some bitmap text objects are being rendered but others are not. Also, with the latest dev version, Firefox no longer freezes up on encountering that error; I can still click on buttons and stuff. Link to comment Share on other sites More sharing options...
rich Posted October 31, 2013 Share Posted October 31, 2013 Upload the font + xml file here please. Link to comment Share on other sites More sharing options...
Hsaka Posted October 31, 2013 Author Share Posted October 31, 2013 Here you go. http://gamepyong.com/skylegend/assets/fonts/desyrel.xmlhttp://gamepyong.com/skylegend/assets/fonts/desyrel.png Link to comment Share on other sites More sharing options...
rich Posted November 1, 2013 Share Posted November 1, 2013 Hmm the desyrel font is part of the Phaser assets, so I know it definitely works in Firefox! Could you pull the latest dev branch please and see what results you get? But that font renders fine for me in Firefox. Link to comment Share on other sites More sharing options...
bubamara Posted November 1, 2013 Share Posted November 1, 2013 @Hsaka : try to edit width and height of character 32 in your desyrel.xml fileset width and height of character to "1"<char id="32" x="305" y="391" width="0" height="0" xoffset="23" yoffset="81" xadvance="23" page="0" chnl="0" letter="space"/>looks like this is pixi related issue : http://goo.gl/8pgjNs -bubamara Hsaka and plicatibu 2 Link to comment Share on other sites More sharing options...
plicatibu Posted November 1, 2013 Share Posted November 1, 2013 bubamara, I did what you suggested and everything started working fine again in version 1.1.1. Thank you. Link to comment Share on other sites More sharing options...
bubamara Posted November 1, 2013 Share Posted November 1, 2013 you're welcome Link to comment Share on other sites More sharing options...
Hsaka Posted November 1, 2013 Author Share Posted November 1, 2013 @bubamara Thanks alot! Everything works fine now Link to comment Share on other sites More sharing options...
Recommended Posts