freetype
[Top][All Lists]
Advanced

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

Re: [ft] Rendering text centered vertically


From: Werner LEMBERG
Subject: Re: [ft] Rendering text centered vertically
Date: Sun, 02 Jul 2006 09:17:27 +0200 (CEST)

> I've gotten to a point where i have no problems rendering text on a
> chosen baseline. I think i have a good understanding of how
> freetype2 works. I can't seem to get my head around how i could
> render text centered in a bounding box.

The standard formula to get the vertical distance <y> of the base line
of vertically centered text within a height <h> is

  y = h/2 - (asc - desc)/2 - desc = h/2 - (asc + desc)/2

where <asc> and <desc> are the maximum values of the ascender and
descender values (the latter is assumed to be negative for values
below the base line) of all glyphs in the string.

Does this help?


    Werner




reply via email to

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