Hello Guest

Author Topic: Creating Custom Fonts  (Read 5285 times)

Ceraph

  • Newbie
  • *
  • Posts: 8
    • View Profile
Creating Custom Fonts
« on: May 22, 2013, 08:24:34 pm »
Hello, we are working on creating our own original bitmap font for our game. The font itself has detail and shading on it, so I cannot create a ttf file from it. I also cannot use BMFont to generate the bitmap font file (unless I'm missing how to start with an image and define the font from that).

I tried using this program: http://code.google.com/p/fonteditor/

Unity did not like the XML that it generated and I get the error "Font parsing returned 0 characters, check source bmfont file for errors" when creating a tk2d font from the XML. Are there any programs that 2D Toolkit supports that will allow me to define the font one character at a time?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating Custom Fonts
« Reply #1 on: May 22, 2013, 09:21:06 pm »
That is the first time I've heard of that program. What does it save exactly? Paste a sample here and I could probably tell you why it failed.

Ceraph

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Creating Custom Fonts
« Reply #2 on: May 22, 2013, 10:46:44 pm »
here is a sample of what it's generating. It looks like it's standard XML and not FNT formatting.

<font>
    <image>DeepDive.png</image>
    <size>40</size>
    <spacing>1</spacing>
    <leading>0</leading>
    <symbol>
        <char> </char>
        <x>152</x>
        <y>272</y>
        <width>18</width>
        <height>34</height>
        <offsetx>0</offsetx>
        <offsety>0</offsety>
    </symbol>
    <symbol>
        <char>!</char>
        <x>420</x>
        <y>220</y>
        <width>25</width>
        <height>35</height>
        <offsetx>0</offsetx>
        <offsety>0</offsety>
    </symbol>
    <symbol>
        <char>"</char>
        <x>489</x>
        <y>169</y>
        <width>25</width>
        <height>35</height>
        <offsetx>0</offsetx>
        <offsety>0</offsety>
    </symbol>
    <symbol>
        <char>#</char>
        <x>557</x>
        <y>169</y>
        <width>25</width>
        <height>35</height>
        <offsetx>0</offsetx>
        <offsety>0</offsety>
    </symbol>
</font>

I have also tried using Shoebox but I'm having problems getting it to recognize my characters properly.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating Custom Fonts
« Reply #3 on: May 22, 2013, 11:16:34 pm »
Sorry, don't use Shoebox - couldn't help you there.
If you don't figure that out, why don't you simply write a bit of code to either:
- convert the font xml to a bmfont xml. Looks straightforward enough.
- write an importer to this file format type in tk2dFontBuilder.cs. If you look at the XmlImporter code, it should be easy enough to create a variant that will read this format as opposed to bmfont. They contain mostly the same data, so it should work fine.

Ceraph

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Creating Custom Fonts
« Reply #4 on: May 24, 2013, 03:55:02 pm »
We were able to write our own method inside tk2dFontBuilder to work with the generated XML, thanks for your help!