Given an input text string, a font family, and a pointsize, I'd like to
draw a filled rectangle background and then draw the text on top of that.
The key is I want the rectangle background to be just large enough to
contain all the text.
The trouble I'm having is that when I render the text (I'm using
FreeTypeGL to render in OpenGL), the output position is used to place
the *baseline* of the text. I seem to be able to accurately compute the
overall bounding box of the text, however, I'm having trouble accurately
figuring out the descender for my string.
And this accuracy is a function of which font I choose.
It seems like the bounding box calculation is always correct. The
problem is that the descender I'm querying is for the font face in
general which I assume accounts for every glyph in the font.
However, if I'm trying to render a particular text string, I only want
the largest descender for the glyphs in that string.
Any suggestions on computing the descenders for individual glyphs?
I took a look at the glyph metrics from FreeType, but these didn't seem
to help. For example, I found a case where "E" seemed to report a
descender (comparing height and vertBearingY).
Any advice on how to properly place a text string exactly into a rectangle?
_______________________________________________
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype