Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Font Line spacing Kerning in GUI system

Discussion in 'Immediate Mode GUI (IMGUI)' started by seon, Aug 15, 2008.

  1. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    How do we get access to the line spacing and kerning settings for fonts? I can see the values in there when I click on a font, but I cannot see how to adjust them.

    I cant find anything in the scripting docs :(

    Please tell me I am able to adjust the kerning and line spacing?
     
  2. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    Aren't those values part of the font itself?
     
  3. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Possibly, but if the values are shown (greyed out though) then we should be able to adjust them.

    We NEED to be able to adjust them to be able to format multi-line text better.
     
  4. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Nicolas... Any thoughts or insights on this?
     
  5. MatthewW

    MatthewW

    Joined:
    Nov 30, 2006
    Posts:
    1,355
    You can change those values for bitmap fonts, but not for fonts imported from a TTF file. It's a bit of a pain to rig a bitmap font for usage, since you'll need to rebuild all kerning values.
     
  6. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Bummer... so how do I fix a problem like this... ?



    From using a TTF ?
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,341
    Change the kerning and spacing in the TTF file with a font editor.

    --Eric
     
  8. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Thanks Eric... can u recommend one? I a still pretty new to the Mac.
     
  9. tolm

    tolm

    Joined:
    Feb 4, 2008
    Posts:
    61
    I'm not Eric and I haven't used it in a while, but TypeTool would probably get the job done. It might be a bit overkill though if all you wanna do is change the line spacing.
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,341
    I have FontForge, which is free, but rather complicated and needs X11.

    --Eric
     
  11. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Ok, nps... am downloading the TypeTool demo now... Thanks TOLM.
     
  12. housewarmer

    housewarmer

    Joined:
    Apr 18, 2008
    Posts:
    74
    It's not cheap, but FontLab Studio is probably the best mac font creation/editor out there. It's probably overkill for small tweaks like this, but for anything more complex it's great.
     
  13. tolm

    tolm

    Joined:
    Feb 4, 2008
    Posts:
    61
    I think you can get quite a long way just with TypeTool. It's essentially FontLab Studio without all that advanced OpenType stuff you won't use anyway.
     
  14. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    I downloaded the TypeTool demo loaded my font in but couldn't make heads or tails about how to use it how to adjust line spacing/line height.

    The font looks fine inside TypeTool, just not so great in Unity as showcased above.
     
  15. tolm

    tolm

    Joined:
    Feb 4, 2008
    Posts:
    61
    I think what you need to do is open "Font Info" from the File menu, and play around with metrics and dimensions. There isn't a line height metric specifically, but you could try changing the UPM size without scaling the glyphs or perhaps increasing the ascender or caps height.
     
  16. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Unity uses the FreeType library for rendering TrueType to bitmaps. It reads the font metrics from the TTF. Lots of fonts, especially low-end novelty fonts, end up having poorly specified metrics. I've seen this in Flash as well that the line spacing, etc., isn't good for some fonts.

    So it's not Unity's fault exactly.

    FreeType does make its own decisions about how to interpret the metrics.

    Something else you'll see sometimes is that the line spacing will change depending on whether you import as Unicode or ASCII. Some Unicode characters in some fonts take up more line height and end up with a different line spacing in the bitmap as a result.
     
  17. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    Hehe oh the joys of standards.
     
  18. housewarmer

    housewarmer

    Joined:
    Apr 18, 2008
    Posts:
    74
    Silly me. I didn't realize that Type Tool was from the same company...doh.
     
  19. drzovil

    drzovil

    Joined:
    Sep 27, 2010
    Posts:
    4
    has it been already solved?

    If not, it can be dealt with FontForge.

    Take a look at HERE.
     
  20. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    470
  21. Compressed

    Compressed

    Joined:
    Sep 20, 2014
    Posts:
    59
unityunity