Jump to content

Generate bitmap font


Laura
 Share

Recommended Posts

Hello!

I am trying to build my own bitmap font using pixi 5. I was able to draw the letters and form a png file with them (attached file - it's a poor quality drawing, wanting to have some test file quickly). The fnt file is something I downloaded from littera and replaced position, height, width values with the ones I computed for my png file. 

When I try to load the font, I get the error: 

core.js:6185 ERROR TypeError: Cannot read property 'size' of undefined
    at BitmapText.updateText (text-bitmap.es.js:172)
    at new BitmapText (text-bitmap.es.js:155)

I am able to load other bitmap fonts from the internet, so I am sure I am doing something wrong with either png or .fnt file. I haven't found much information on the internet regarding the fnt, so if you have some ideas on what seems wrong, I'd really appreciate it. Do you think this is fixable?

Thank you,

Laura

testFont.png

testFont.fnt

Link to comment
Share on other sites

If anyone faces the same issues, I have discovered the problem. In the fnt file:

<font>
  <info face="testFont" size="72" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="0,0,0,0" spacing="0,0" outline="0"/>
  <common lineHeight="80" base="57" scaleW="361" scaleH="512" pages="1" packed="0"/>
  <pages>
    <page id="0" file="testFont.png"/>
  </pages>
...

On line 2, face="testFont" must match the name from line 5 (file = "testFont.png")

Apparently, this undefined size error is a facade for anything that might be wrong with the font file.

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...