freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] Finding hinted ascent and descent values


From: Ian Brown
Subject: [Devel] Finding hinted ascent and descent values
Date: Wed, 17 Nov 2004 12:49:19 +0100

Hi,
        I need to be able to get the same value that windows returns in
the TEXTMETRIC.tmHeight value from freetype. From what I can gather,
this is the hinted version of ascent - descent.
        It says in the freetype headers that to get this, a client needs
to render each glyph. For performance reasons, the freetype library just
linearly scales the ascent and descent values. My question is how to
actually get the hinted and scaled values for the ascender and descender
once I have loaded a glyph. My code so far looks as follows (m_face is a
FT_Face structure). Can someone give me a hint as to what I need to
access after loading the glyph.

Thanks,

Ian

double FL_FTFace::GetTMHeight()
{
        double retval = 0.;
        if (m_face){
                int max_asc = 0;
                int min_dsc = 0;
                int num_glyphs = m_face->num_glyphs;
                for (int g=0; g < num_glyphs; ++g){
                        FT_Error error = FT_Load_Glyph(m_face, g, 0);
                        if (!error){
                                // need to get the ascender / descender
for the glyph here and
                                // update max_asc and min_dsc as
appropiate
                        }
                }
        }
        return retval;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]