PhaserEditor2D / PhaserEditor

A friendly IDE to develop HTML5 games based on the Phaser framework.
https://phasereditor2d.com
Eclipse Public License 1.0
330 stars 45 forks source link

Adding bitmap text does not work #112

Closed Kababaer closed 5 years ago

Kababaer commented 5 years ago

Version

Description

Within a Group Prefab, right click in the canvas editor -> Text -> Add Bitmap Text -> Enter a random text -> choosing a bitmap font from the menu which is showing -> hit ok -> confirm, that nothing happens. It's not added to the canvas nor to the left "asset window". The bitmap file is *.fnt.

Edit: The bitmap was created using littera. I just see, when I drop the bitmap font into the preview, it says: Missing bitmap font descriptor.

Possible solution

PhaserEditor2D commented 5 years ago

Hi, please attach here the fnt file. Phaser only supports Xml and Json.

Kababaer commented 5 years ago

Cannot attach that file typ. I don't wanna write the complete file here as it has more than hundred lines. Littera offered the file typ XML (fnt) but only gives me the .fnt and the *.png.

Can you suggest a workaround?

PhaserEditor2D commented 5 years ago

Hi, you can find here the tools Phaser supports. https://phaser.io/docs/2.6.2/Phaser.Loader.html#bitmapFont

PhaserEditor2D commented 5 years ago

By the way, if littera exports to XML, try with it, no matter if the file extension if fnt.

Kababaer commented 5 years ago

The unfunny thing is that littera offers the xml export but just give the .fnt which actually looks like .xml as it has a lot of tags and attributes like <char xSpacing=""..../char>. However, this is information seems to be "not enough" for phaser editor as something seems to be missing. The bitmap font is working ingame, but not in preview. The idea was to design a complete dialoge as group prefab inclusive the text and make the text wrapping in the prefab too, if necessary (instead of calculate all that).

PhaserEditor2D commented 5 years ago

Please, just paste a few lines of the content of the xml/fnt file here. Other users had issues with the format of the xml.

Kababaer commented 5 years ago

Sry, wasn't here a long time ago.

<font>
  <info face="font" size="72" bold="1" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/>
  <common lineHeight="72" base="63" scaleW="694" scaleH="511" pages="1" packed="0"/>
  <pages>
    <page id="0" file="font.png"/>
  </pages>
  <chars count="93">
    <char id="97" x="2" y="2" width="56" height="47" xoffset="9" yoffset="18" xadvance="72" page="0" chnl="15"/>
    <char id="98" x="2" y="51" width="56" height="65" xoffset="9" yoffset="0" xadvance="72" page="0" chnl="15"/>
    <char id="99" x="2" y="118" width="56" height="47" xoffset="9" yoffset="18" xadvance="72" page="0" chnl="15"/>
    <char id="100" x="2" y="167" width="56" height="65" xoffset="9" yoffset="0" xadvance="72" page="0" chnl="15"/>
    <char id="101" x="2" y="234" width="56" height="47" xoffset="9" yoffset="18" xadvance="72" page="0" chnl="15"/>
    <char id="102" x="2" y="283" width="56" height="65" xoffset="9" yoffset="0" xadvance="63" page="0" chnl="15"/>
    <char id="103" x="2" y="350" width="56" height="56" xoffset="9" yoffset="18" xadvance="72" page="0" chnl="15"/>
  </chars>
</font>

Within the chars-tag, there a many more chars. Just excluded them to keep the lines of xml small.

PhaserEditor2D commented 5 years ago

Well, I don't see any problem with the format. If you can send me the whole file and texture I can test here and find the problem.

Kababaer commented 5 years ago

Sent you guys an e-mail due to upload restrictions.

PhaserEditor2D commented 5 years ago

Hi,

Thanks for sending me the files.

It is working to me! The trick is to rename the file Pixel8Active.fnt to assets/Pixel8Active.fnt.xml, you should add a .xml extension. Please, try and tell me if it works for you.

image

PhaserEditor2D commented 5 years ago

By the way, I recommend to use the latest version of the v1 series: 1.5.3.

PhaserEditor2D commented 5 years ago

Can I close this?

Kababaer commented 5 years ago

Sry, had vacation. Will test it out tomorrow and will give feedback then.

PhaserEditor2D commented 5 years ago

@Kababaer there is no hurry! Enjoy the vacations!

PhaserEditor2D commented 5 years ago

Done, will be included in 1.4.5 very soon.