true type font vertical alignment issue
Posted on 2004-08-06
I have text that I am placing on an image
I am allowing the user to select color, font, horizontal justification and location.
I am doing this by using a jedi tools movable bevel.
This bevel returns (of course) a top, left width and height.
I want the text to appear on the baseline of this box.
I have been doing it in this order:
1. get inputs from user
2. apply font name, size, color etc.
3. get WIDTH from label and justify appropriately
(now it gets tricky... I'm obviously doing it WRONG but heres what i'm doing)
4. I get the HEIGHT of the label I'm working with and move it to the baseline by doing:
text.top := bevel.top + bevel.height - text.height (I have autosize turned on for the label)
I have ALSO tried to use + text.font.height (is is always a negative value... I have never asked why)
the first one works great with a large number of fonts like arial narrow etc. It does NOT work with some fonts like arial black or impact. This is unacceptable as these are two of what will be the most popular fonts to use!
What will happen is that the bottom of the font will go below the bounding box ( the bevel ) and not rest nicely on the baseline. Am I grabbing the wrong properties? What am I missing??? Unfortunately this is holding up the whole project ;(
Thanks for any help you might give ;)
[edited to make last sentence make sense]