Custom TTF font's baseline is wrong in unity (weird vertical offset)
I'm looking to restyle part of one of my UIs, but when I went to change the font, I ran into a problem where all the text got shifted up by quite a lot. Here is a pair of screenshots of a simple vertical layout with 3 Text objects. The only thing changed is the font face (Arial versus Pixel Noir):
When I was using the font to do mockups (Paint+Photoshop), changing the font face didn't shift the text up or down. I even opened the font in a font editing program to check where its baseline is, but the base of the glyphs are drawn at the 0-mark (which is the font baseline).
I guess there must be something different about the way Unity is displaying fonts versus other programs, but is there another (better) way to fix this issue other than going through all my text objects and manually offsetting them?
Answer by mmitchell · Jan 09, 2016 at 05:54 PM
Nevermind, it looks like this is an issue with the font, mostly. The gylphs are larger than they claim to be (e.g., at 8px the characters are actually around 16px), which I think is what's throwing Unity off. Editing the font so that the gylphs are the correct size fixed the positioning issue. :)
I downloaded fontforge to try and fix some of my dynamic fonts, though I'm having difficulty getting a grasp on it. If you have time, could you elaborate on your process or give a few tips? it would help immensely. Thanks!
Your answer

Follow this Question
Related Questions
jumpy dinamic font 0 Answers
UI buttons sometimes does not detect touch 0 Answers
What is the standard way to handle UI updates that involve creating and destroying GameObjects? 0 Answers
Canvas Structure for Different UI Panels 0 Answers
OnpointerClick not working(parents gameObject has EventTrigger) 0 Answers