[Top][All Lists]

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

Re: [Freetype] tmAscent in Windows fontMetrics

From: Huw D M Davies
Subject: Re: [Freetype] tmAscent in Windows fontMetrics
Date: Fri, 21 Feb 2003 14:15:00 +0000
User-agent: Mutt/1.4i

On Fri, Feb 21, 2003 at 01:49:10PM +0100, Roman Bednarek wrote:
> Hi.
>   In Windows version of my appplication I am using the following value
> textmetric.tmAscent+textmetric.tmInternalLeading+textmetric.tmExternalLeading.
> I have to be compatible in freetype version, but I cannot get the same
> value from FT_Face fields. I am adding an arbitrary(guess) value to
> face->ascender which is not really good solution.
>   Is there a good way to get exactly the same value using freetype?

If the font is a TrueType font then Windows first looks for the VDMX
table to convert from lf.lfHeight to the number of pixels in the EM
sqaure (ppem).  The ymin and ymax values from this table correspond to
tmAscent and -tmDescent.  tmInternalLeading is tmAscent + tmDescent -

If the vdmx table doesn't exist or the font size is larger than the
largest record in the vdmx table, then the font gets scaled linearly
ppem = units_per_em * height / (usWinAscent + usWinDescent) where
usWin* are in the OS2 table.  In this case tmAscent/Descent correspond
to the scaled values of usWinAscent/Descent and tmInternalLeading is
the scaled value of usWinAscent + usWinDescent - units_per_EM

tmHeight is always tmAscent + tmDescent

tmExternalLeading = max(0, y_scale * (HHEA->Line_Gap - ((usWinAscent +
usWinDescent) - (HHEA->Ascender - HHEA->Descender)))

where HHEA->* are members of the HHEA table.

This all comes from Wine (  It's probably a
good idea to look at the file dlls/gdi/freetype.c where all this fun
and games lives.

Hope this helps,

reply via email to

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