Re: Help understanding Pango layout metrics



Hi Marting

On Nov 6, 2009, at 8:25 PM, Martin Vollrathson wrote:

Hello!

I was recently confused by the metrics involved in laying out text
with Pango and Cairo.

What I needed and expected was a way to specify the size and family of
the font and the height of the lines and then have the text rendered
accordning to those specifications. However I was very confused by the
concept of line spacing and the absence of a line height property.


It can be a little confusing.

When I found the line spacing property I assumed that the _heigh_ of
the lines always was identical to the size of the font, however this
apperas not to be so. I am very accustomed to the concept of
line-height and font-size from CSS, perhaps that's why I find the
Pango counterparts difficult to grasp.


I find the Freetype guide explains the terms used in Pango and Freetype pretty well: http://www.freetype.org/freetype2/docs/tutorial/step2.html


Could someone please elaborate on how I can most easily control the
height of the lines in a Pango layout?

What I want is a way to control the exact distance between the
baselines of each line of text in a layout and perhaps the position of
the baseline relative to each line.


I do not know if this can be done in an easy way. As I understand, your request is to specify a height, and then no font will be exceed that height? If you use fontconfig you might be able to specify something in your font description, I have not found it though.


Best regards.
--
Jesper L. Nielsen
Senior Software Engineer @ 2M-Locatel



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