freetype
[Top][All Lists]
Advanced

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

Re: [ft] Rendering text centered vertically


From: Alexander Cohen
Subject: Re: [ft] Rendering text centered vertically
Date: Sun, 02 Jul 2006 11:02:32 -0400

This helps a bit. But how do i get all of these values. It seems like these values are not always defined.

AC

On 2-Jul-06, at 3:17 AM, Werner LEMBERG wrote:


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]