[Top][All Lists]

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

Re: [ft] How to determine font ascent

From: Anson
Subject: Re: [ft] How to determine font ascent
Date: Wed, 12 Oct 2005 14:40:44 +0100

I have been looking at this ascender/descender business for a while and had a similar problem.  To the best of my knowledge FreeType does not provide the metrics you are after.  Metrics from bbox definitively include all the glyphs in the font file (hence box drawing characters are always included.)  Other provided metrics don't seem to be particularly useful either.

I don't know if such problem bothers other people.  What I have done in our environment to remedy it is to hardcode certain glyph samples to calculate metrics, i.e. for each writing script we specify several glyphs ("normal characters" in your language.)  The resultant metrics seem to be more accurate.

I don't know fontforge so I couldn't comment on that.


On 10/11/05, Andrew Zabolotny <address@hidden> wrote:

In order to correctly display glyphs I need to know somehow the
baseline and the "top baseline" (don't know the correct term, the term
"ascent" seems used for many things that aren't what I mean) of the
font. For example, if you don't understand what I mean, fontforge
displays these two horizontal lines with thin gray lines, and even
shows the "top baseline" Y coord in the Font Info -> Common -> Ascent

The FT_Face structure contains the max bounding box (bbox) of all the
character in the font, and the ascender/descender values; however these
are not the values I'm looking for - the 'ascender' value given by
freetype is the highest point even hit by a single character, and not
the "top value" intended for normal characters, but which can be
exceeded by e.g. diacritics.

I need this to properly vertically center a character, otherwise I get
what you can see on this screenshot:

The only way I can think of to achieve vertical centering is to know how
much of a character may go below the baseline (here the "descender"
value works fine, provided baseline is always at 0 (is this true?)).
And if I also will know how much a character may go *above* the *top
baseline*, I can take the biggest of these two values and add such an
amount of space below the bottom baseline, and above the top baseline,
thus glyphs will look vertically centered.

Can anyone tell me, how I can get the Y coordinate of the "top
baseline", or "ascent", in fontforge terms.


Freetype mailing list

reply via email to

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