AngelFont (and others) x,y offset

Monkey Programming Forums/User Modules/AngelFont (and others) x,y offset

frank(Posted 2013) [#1]
It seems whatever package I try to use (usually GlyphDesigner, but others do it too) they all seem to add xOffset / yOffset. That is quite annoying and I removed the whole facility from AngelFont. Why are these useful and more interestingly; how can I switch them off in Bitmap font generation packages.

(Disclaimer: you might notice ; I know nothing about fonts :)


Beaker(Posted 2013) [#2]
They are for kerning, which you can turn off using a flag in AngelFont I think. Kerning makes your font characters space much nicer.
http://en.wikipedia.org/wiki/Kerning

More importantly, why are they annoying, and why would you want to turn them off?


CGV(Posted 2013) [#3]
More importantly, why are they annoying, and why would you want to turn them off?

He already answered that :)
(Disclaimer: you might notice ; I know nothing about fonts :)



frank(Posted 2013) [#4]
I use tools to position elements which generate JSON files I read in my game to show things. If I position images, they come out nicely, but text is always wrong because Photoshop/Gimp/Inkscape seem to not use those offsets when providing you with coordinates of where everything is. So it takes far too much time to tweak positioning with those offsets and make them come out as I intended when I made the artwork. How do you do that?


Nobuyuki(Posted 2013) [#5]
generally speaking, since you can't really align angelfont output vertically by a font's baseline, you can guesstimate the amount of offset you need by measuring the difference between a font's x-height (usually the top of the character "x") and its highest ascender (usually "f" or "|").

Perhaps a more accurate way to find a good place to offset by is to take the negative of the yoffset value of the character you want to align by in your .FNT file. Chr(65) is "A" and Chr(120) is "x". Subtracting the yoffset value from your desired y-position on screen should align the top of that character to your desired position.


Edit: Or, maybe you can just look for "lineHeight" and "base" values in the .FNT file. I'm guessing "base" is the baseline value, and you can subtract that number from your desired y-position to align your text's baseline to that value. "lineHeight" is probably the amount of clearance you should leave the text, or possibly the maximum ascender height (I don't know).