freetype
[Top][All Lists]
Advanced

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

Re: [ft] Vertical Center Justification


From: Richard Destremps
Subject: Re: [ft] Vertical Center Justification
Date: Sat, 17 Oct 2015 12:56:50 -0400

Good point.  I will answer your question.

I think it would help our discovery and learning process to explain the typical 
and usual calculation (algorithm) most "printing devices" use to vertically 
center justify glyphs within a defined field (text box).  Once we understand 
how this is accomplished we can apply the principle to our special case. 

I'm beginning to believe this is accomplished by using the bounding box 
dimensions and the vertical dimension of the text field and then some basic 
math to align the centers of the glyph with the center of the text box.  We are 
creating a TTF, so all of the font data tables exist. It would be most helpful 
if you could point out the specific table values to use for this calculation & 
show us the math algorithm that is used.

Of course, one of the variables in this calculation will be the vertical height 
of the text box. In our case this is a text box that has been defined as the 
available marking field by our product graphic designers.

Can you explain to me how are the text box dimensions passed to the FreeType 
engine so that position justification can be calculated?

One of the things that is confusing us is the fact that the FreeType engine is 
perfectly centering the glyph horizontally but not vertically. We are wondering 
why one works but not the other. Horizontal center justification works if you 
build the glyph as I described in my first Email. But vertical center 
justification does not, and we have moved the glyph to every position we can 
think of. 

Rich Destremps
(Cell) 610-533-9482

> On Oct 17, 2015, at 3:01 AM, Werner LEMBERG <address@hidden> wrote:
> 
> 
>> Vertical Center Justification
> 
>> We can’t figure this out!  We don’t understand how the FreeType
>> engine calculates vertical centering.  Can you please give me exact
>> instructions on where to place the glyph Relative to the WinAscent
>> and WinDescent and Baseline to achieve perfect vertical centering?
>> Or do I have it all wrong and this is a calculation that uses the
>> bounding box dimensions.  Whatever it is please let me know how to
>> accomplish this.
> 
> You haven't told us relative to *what* you would like to center the
> icon...
> 
> Assuming that you simply want to have the glyph as an image, to be
> positioned without relation to surrounding text, I would definitely
> use the bounding box, since many fonts don't properly set up WinAscent
> and WinDescent values.
> 
> 
>    Werner

reply via email to

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