freetype
[Top][All Lists]
Advanced

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

Re: [ft] scalable font metrics, ascent/descent/height, metrics struct


From: Werner LEMBERG
Subject: Re: [ft] scalable font metrics, ascent/descent/height, metrics struct
Date: Tue, 24 May 2005 16:18:55 +0200 (CEST)

> All I'm trying to do is to read in a TTF file (hence scalable
> font?), specify a required size in pixel, and determine some font
> metrics (as opposed to individual glyph metrics) based on the
> required size.  Have a look at the attached file.  All I need is to
> get those 22, 4, 6, 32 values (they may not be right as I didn't
> collect them based on all glyphs in the font file.)

Please read the FreeType documentation files at

  http://freetype.freedesktop.org/freetype2/documentation.html

(www.freetype.org is currently unavailable) and also check the
OpenType specification.

> My first question is that if FreeType is capable to distinguish for
> example 'A' from the 'A' with a circle/ascent?  What about
> characters with descent?

What do you mean with `distinguish'?  If the metrics in the font are
correct, you'll get a bigger height for the Aring glyph.  Note that
for example TeX fonts don't have metrics which exactly correspond with
the smallest bounding box.

> Now I get a metrics structure in ftFace->size->metrics and they are in
> something called "26.6 frac. pixels".  I don't understand this very
> well as they are in several thousands (more like vector coordinate)
> instead of something close to 30.  How do these fractional pixels
> related to the 30-pixel size?

26.6 frac pixels means that a 32bit integer is slit into a 26bit
integer part and a 6bit fixed fractional part.  With other words, you
have to divide the result by 64 to get `real' numbers.  Example:

  1920  -> 30.0
  1921  -> 30.016

> My last question would be on the numerous metrics structures.  To my
> understanding metrics in "FT_Face" is before scaled, whereas the
> "FT_Size_Metrics" in a "ftFace->size->metrics" is scaled.  How are
> they related to the metrics in a TT_Face structure?  Would one be
> more accurate than the others?

You have to distinguish between device-dependent and
device-independent metrics.  A glyph rendered on screen normally gets
a width which is an integer pixel value -- often caused by hinting
instructions during the rendering process -- while the same glyph
could have a fractional value (slightly larger or smaller) if the
metrics value is scaled linearly.


    Werner




reply via email to

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