[reportlab-users] Height of a String

Andrea Cappelli a.cappelli at gmail.com
Sat Mar 21 06:36:45 EDT 2009


Andy Robinson ha scritto:

> Not with perfect accuracy. For our own purposes, we assume text

> should fit in a box which extends by [fontsize] up from the baseline,

> and [leading - fontsize] downwards, but this box will have some

> extra white space.

>

>


So if in a Paragraph I set the font and the leading the same value i get
lines with no space between?
I my tries seems that the leading parameter of a Paragraph isn't the
same measure unit of fontSize, but i could be wrong


> This means that if you drew a string in Helvetica 10 points it would

> mostly fit in 7.18 points above the baseline and 2.07 points below.

>


Why you say '10 points'? Is the reference fontSize? How can link 10
points to the ascent and the descent?


> However, this is the designer's metrics for the whole font. It does

> not cover each individual glyph in YOUR string, which may vary.

>


Ok


> If working with type 1 files, you might have an 'afm' file with readable

> text metrics. Otherwise, getting the precise size of a string requires

> libraries to read the detailed glyph sizes (Just van Rossum's fonttools

> is good). Our library doesn't go to this level of detail, sadly.

>


Thank you very much, i'll check this library


More information about the reportlab-users mailing list