freetype-devel
[Top][All Lists]
Advanced

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

[Devel] RE: Finding hinted ascent and descent values


From: Ian Brown
Subject: [Devel] RE: Finding hinted ascent and descent values
Date: Wed, 17 Nov 2004 14:53:40 +0100

I figured it out - the code below seems to work. Note that for windows
compatibility, you need to make sure you only load the characters in the
currently selected code page.

If anyone can see any problems with the code, please let me know.

Ian

double FL_FTFace::GetTMHeight()
{
        double retval = 0.;
        if (m_face){
                int maxasc = 0;
                int maxdsc = 0;
                for (int c=32; c < 256; ++c){
                        int g = GylphNumForCharacter(c);
                        FT_Error error = FT_Load_Glyph(m_face, g, 0);
                        if (!error){
                                if (m_face->glyph->metrics.horiBearingY
> maxasc){
                                        maxasc =
m_face->glyph->metrics.horiBearingY;
                                }
                                int dsc = m_face->glyph->metrics.height
- m_face->glyph->metrics.horiBearingY;
                                if (dsc > maxdsc){
                                        maxdsc = dsc;
                                }
                        }
                }
                retval = (double)(maxasc + maxdsc) / 64.;
        }
        return retval;
}





reply via email to

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