Leading Pango Metrics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Leading Pango Metrics

Alex Vazquez
Hi! I have a question about get metrics of a font.
If I don't understand wrong the height of a font is ascent+descent+leading.
with pango I can get ascent and descent but i can't get the leading.
I try calculate the leading with  pango_layout_get_spacing() but this value get me 0.
Also I try get leading with pango_layout_get_pixel_size() but the result is ascent + descent.
I'm using as a font "Purisa"
Can i calculate the leading of a font using pango ? 

Regards!



_______________________________________________
gtk-i18n-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Reply | Threaded
Open this post in threaded view
|

Re: Leading Pango Metrics

Owen Taylor
On Thu, 2016-01-28 at 13:25 +0100, Alex Vazquez wrote:

> Hi! I have a question about get metrics of a font.
> If I don't understand wrong the height of a font is
> ascent+descent+leading.
> with pango I can get ascent and descent but i can't get the leading.
> I try calculate the leading with  pango_layout_get_spacing() but this
> value get me 0.
> Also I try get leading with pango_layout_get_pixel_size() but the
> result is ascent + descent.
> I'm using as a font "Purisa"
> Can i calculate the leading of a font using pango ? 

"leading" isn't a property of a font, but rather of how it's used - and
does corresponding to pango_layout_get_spacing().

The standard for computer fonts is that the point size of the font -
say 12pt, is equal to the ascent+descent, and a lot of computer fonts
look pretty good "set solid" without extra leading, at least for short
line lengths.

However, what is a bit confusing is that you actually do end up with
visible space between lines in most cases. If you put a Å directly
underneath a g, they might touch, but if you stick to unaccented
characters, there is a gap between lines.

- Owen

_______________________________________________
gtk-i18n-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Reply | Threaded
Open this post in threaded view
|

Re: Leading Pango Metrics

Guillermo Rodriguez Garcia
In reply to this post by Alex Vazquez
Hi,
 
From: Owen Taylor <[hidden email]>
Date: 2016-01-29 20:44 GMT+01:00
Subject: Re: Leading Pango Metrics
To: Alex Vazquez <[hidden email]>, [hidden email]

On Thu, 2016-01-28 at 13:25 +0100, Alex Vazquez wrote:
> Hi! I have a question about get metrics of a font.
> If I don't understand wrong the height of a font is
> ascent+descent+leading.
> with pango I can get ascent and descent but i can't get the leading.
> I try calculate the leading with  pango_layout_get_spacing() but this
> value get me 0.
> Also I try get leading with pango_layout_get_pixel_size() but the
> result is ascent + descent.
> I'm using as a font "Purisa"
> Can i calculate the leading of a font using pango ? 

"leading" isn't a property of a font, but rather of how it's used - and
does corresponding to pango_layout_get_spacing().

But fonts can actually carry information about suggested leading (line gap). This is available in the "OS/2" and "hhea" TrueType tables (see: https://fontforge.github.io/fontinfo.html#TTF-Metrics).

Can't this metric be retrieved via Pango ?

Best,

Guillermo Rodriguez Garcia
[hidden email]

_______________________________________________
gtk-i18n-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list