Jump to content

PIXI V3 Bitmapfont problem!


jaevelgames
 Share

Recommended Posts

I'm in the process of turning my current project into V3, when I get this error regarding my bitmap text: "Uncaught TypeError: Cannot read property 'size' of undefined". 

 

The error occurs in BitmapText.js, and more specifically here: " var scale = this._font.size / data.size;".

 

I'm declaring the font size in a variable like this: "textStyle = {font: '12px Minecraftia', align: 'center'}", which worked well in V2.

 

Since I'm a noob, and cant find any help from examples or such, I'm thankful for any help here :)

 

Have a great day!

Link to comment
Share on other sites

  • 2 weeks later...

I'm having the exact same issue.

 

I have fnt & tga files and am loading the files with the asset loader

//removed other assets for simplicitythis.allAssets = ['fonts/indieflower.fnt', 'fonts/itckabel.fnt', 'fonts/indieflower.tga', 'fonts/itckabel.tga'];

I am trying to create the text with this code ..

this.finalScore = new PIXI.extras.BitmapText("testing", {font: 'bold itcKabel', align: 'center', fill: '#aa2821'});

and am getting the same error as jaevelgames.

 

I'd really appreciate some assistance, cheers xerver! 

 

Nearly finished my first canvas, javascript app/game. Looking forward to sharing.

Link to comment
Share on other sites

Oh this already has a workaround, and a fix for the next release of pixi:

https://github.com/GoodBoyDigital/pixi.js/issues/1708

**EDIT**: Looks like you are using 3.0.2 and this still doesn't work...hmm.. looking into some more.

TGA isn't getting recognized as an image which could be contributing to this, I patched resource-loader to add support in v1.5.4 so you could do a custom build with that version (or wait for the next pixi release). Not 100% sure that is the cause of your issue yet though. Still investigating.

**EDIT 2**: Ok, found the core of your issue here. .fnt files are expected to be an XML font. The files you are loading, I have no idea what those are but its definitely not the XML font format we expect :)

http://www.feref.com/jonTest/dumb_remake/fonts/indieFlower.fnt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...