freetype
[Top][All Lists]
Advanced

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

[ft] How to determine font ascent


From: Andrew Zabolotny
Subject: [ft] How to determine font ascent
Date: Wed, 12 Oct 2005 02:42:38 +0400

Hello!

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
entry.

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:

http://cs.ozerki.net/zap/ttf/dejavu-sans.png

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.

-- 
Greetings,
   Andrew




reply via email to

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