Search Unity

Converting an image to True Type Font or other Unity Font

Discussion in 'Editor & General Support' started by Mangopork, Aug 29, 2010.

  1. Mangopork

    Mangopork

    Joined:
    Aug 16, 2009
    Posts:
    108
    Hey,

    I need help.

    I have a font sheet that I created as a PNG image file. Need to convert it to a font format that is usable by unity (such as Truetype)

    Photoshop/Illustrator wont' do it, neither will irfanview.

    Trying cygwin/font forge but it's painful to use for just one file...

    Any ideas on how to do this?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can leave it as a PNG, and set up a custom font in Unity. Although it's kind of a pain since you have to set the kerning for each character manually.

    --Eric
     
  3. Matt_001

    Matt_001

    Joined:
    Sep 17, 2010
    Posts:
    101
    I'm doing the same thing with a PNG file as well.

    I would like to set the width of each character in my custom font, is it possible?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, adjust the per-character kerning.

    --Eric
     
  5. Matt_001

    Matt_001

    Joined:
    Sep 17, 2010
    Posts:
    101
    The problem is that my texture font numbers have different width and does not contain all characters.

    For example, my font has 12 characters ", 0 1 2 3 4 5 6 7 8 9 x ". I would like to store them in a texture without any "blank space". So if I set the per-character kerning to 0 for each char between ", and 0" as well as those between "9 and x". When Unity import those 12 characters how will it map the three characters between "," and "0"? ("," ASCII number is 44 and "0" is 48)

    I'm concerned about the fact that he could map "0" with my number "3" texture because even if I set kerning 0 to each char between "," and "0", it might still pick a fixed-width character in my texture to represent them. Thus, it's why I need a property for setting the width of each character that are represented in my texture, do we have access to that?

    (Hope I was clear enough, my English skill is far from perfect)
     
  6. Ntero

    Ntero

    Joined:
    Apr 29, 2010
    Posts:
    1,436
    The issue right now is that the Kerning affects the position of the next character, but is not affecting the width of the current one.
    In a TTF font or optimized sprite image the width of the W character is not the same width as the | character. So there should be a character width property in addition to the kerning that can be modified. But we can't seem to find it.
     
  7. Matt_001

    Matt_001

    Joined:
    Sep 17, 2010
    Posts:
    101