ReFreezed / ReFreezedBitmapFontConverter

ReFreezed Bitmap Font converter - convert simple bitmap fonts to AngelCode's BMFont.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option for outputting descriptor files in XML format

titanix opened this issue · comments

Hello, I'm using the Universal version in command line: ./love.app/Contents/MacOS/love RbmfConverter.love rasterize
In rasterize folder rasterize.rbfm (HanaMinA is Hanazono font):

version=1

[in]
fontFile=HanaMinA.ttf
fontSize=16
fontHinting=normal
textFile=input_chars.txt

[out]
fileImage=test.png
fileDescriptor=test.fnt

glyphColor=1 0 0

input_chars.txt content: あ公キ今日

Image output is as expected.
Issue is with the output test.fnt:

info face="" size=22 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=0 aa=0 padding=0,0,0,0 spacing=0,0 outline=0
common lineHeight=22 base=22 scaleW=72 scaleH=16 pages=1 packed=0 alphaChnl=0 redChnl=0 greenChnl=0 blueChnl=0
page id=0 file="test_0.png"
chars count=5
char id=20170 x=0 y=0 width=16 height=15 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=15
char id=20844 x=16 y=0 width=16 height=15 xoffset=0 yoffset=3 xadvance=17 page=0 chnl=15
char id=12354 x=32 y=0 width=14 height=15 xoffset=1 yoffset=3 xadvance=17 page=0 chnl=15
char id=26085 x=46 y=0 width=12 height=15 xoffset=2 yoffset=4 xadvance=17 page=0 chnl=15
char id=12461 x=58 y=0 width=14 height=14 xoffset=1 yoffset=4 xadvance=17 page=0 chnl=15

instead of (manually fixed):

<?xml version="1.0"?>
<font>
<info face="" size="22" bold="0" italic="0" charset="" unicode="1" stretchH="100" smooth="0" aa="0" padding="0,0,0,0" spacing="0,0" outline="0"/>
<common lineHeight="22" base="22" scaleW="72" scaleH="16" pages="1" packed="0" alphaChnl="0" redChnl="0" greenChnl="0" blueChnl="0"/>
<pages>
<page id="0" file="test_0.png"/>
</pages>
<chars count="5">
<char id="20170" x="0" y="0" width="16" height="15" xoffset="0" yoffset="3" xadvance="17" page="0" chnl="15"/>
<char id="20844" x="16" y="0" width="16" height="15" xoffset="0" yoffset="3" xadvance="17" page="0" chnl="15"/>
<char id="12354" x="32" y="0" width="14" height="15" xoffset="1" yoffset="3" xadvance="17" page="0" chnl="15"/>
<char id="26085" x="46" y="0" width="12" height="15" xoffset="2" yoffset="4" xadvance="17" page="0" chnl="15"/>
<char id="12461" x="58" y="0" width="14" height="14" xoffset="1" yoffset="4" xadvance="17" page="0" chnl="15"/>
</chars>
</font>

The output is quite regular so I can fix it on my side with a program, but that may be an issue for other people.

I can add a setting for what output format should be used in the next version. Might I ask what program uses XML files for BMFonts?

Oh, I was under the impression that .FNT was a native XML format. I'm using BMFont and ReFreezedBitmapFontConverter to generate sprite fonts which are used with MonoGame.Extended, a library for the framework MonoGame. The library has code for importing the fonts in the so called content pipeline which is used to prepare assets in MonoGame.

When I tried using the font outputted by ReFreezedBitmapFontConverter I got an error in the content pipeline about XML formatting, so I copied the format I got from BMFont output (XML) to the one I got from ReFreezedBitmapFontConverter and it worked, both for compilation and at runtime.

Thanks for the info. fnt files have a simple text format, an xml format, and a binary format it seems. The official documentation is a bit lacking on that front. I just had a need for the simple format when I made the program so that's all I implemented. But I'll add an option for it.

Outputting an XML file should now work by specifying a descriptorFormat parameter:

[out]
descriptorFormat=xml

It works. Thank you very much!