[Fontconfig] text string bounding box - top and bottom limits?

mathog mathog at caltech.edu
Wed Oct 10 15:42:05 PDT 2012


This is probably a FreeType question, but I'm not sure.  For placing 
text with respect to a point the EMF file format specifies 
Left|Center|Right, and Top|Baseline|Bottom.   FT_Get_Glyph() returns a 
glyph from
which one may extract advance.x with:

            status = FT_Get_Glyph( fti->faces[idx]->glyph, &glyph );
            if ( !status ) {
                 xe += fti->faces[idx]->glyph->advance.x;

add those up and it gives the string width, albeit with one extra 
"bearingX". That could be used to figure out Center
and Right (if the missing bearingX value was known.) To figure out 
"top" and "bottom" I need the yMax and yMin values.
(These names are from the Glyph Metrics illustration  here

    http://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
)

There are two cases too: boundary fits one particular string (box fits 
specific glyphs exactly) and the limit bounding box for the whole font 
(bounding box height fits any characters in text).

Where does one obtain these values?  I see FT_Glyph_Get_CBox() and 
assume it corresponds to one of these cases, but I'm not sure which one.

Thank you,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech


More information about the Fontconfig mailing list