pango_layout_get_extents() question

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

pango_layout_get_extents() question

David Mosberger
For the ink and logical rectangles returned by
pango_layout_get_extents(), is the ink rectangle supposed to be
contained within the logical rectangle?  I'm seeing a case where this
doesn't seem to be the case:

  text `W': ink: x=1024 y=2048 w=7168 h=6144, logical: x=0 y=0 w=7168 h=10240

Here, the ink and logical rectangles have the same width (7168), but
the ink rectangle as an x offset of 1024 whereas the logical rectangle
has an offset of 0.  This doesn't make sense to me, but perhaps I'm
just not understanding the API.

Thanks and best regards,

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

Re: pango_layout_get_extents() question

Owen Taylor
I'm not sure about your particular case, but in general, ink is not necessarily contained within the logical rectangle - there might be flourishes and tails on letters that overlap with the adjacent letters - the logical rectangle just determines spacing.

Try:
 pango-view --annotate=1 --text f --font 'DejaVu Sans Italic 80'
 pango-view --annotate=1 --text fo --font 'DejaVu Sans Italic 80'

And that should make it clear.

Owen

----- Original Message -----

> For the ink and logical rectangles returned by
> pango_layout_get_extents(), is the ink rectangle supposed to be
> contained within the logical rectangle?  I'm seeing a case where this
> doesn't seem to be the case:
>
>   text `W': ink: x=1024 y=2048 w=7168 h=6144, logical: x=0 y=0 w=7168 h=10240
>
> Here, the ink and logical rectangles have the same width (7168), but
> the ink rectangle as an x offset of 1024 whereas the logical rectangle
> has an offset of 0.  This doesn't make sense to me, but perhaps I'm
> just not understanding the API.
>
> Thanks and best regards,
>
>   --david
> _______________________________________________
> gtk-i18n-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>
_______________________________________________
gtk-i18n-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pango_layout_get_extents() question

David Mosberger
Ah, thanks for the explanation and the pango-view examples.  Didn't know about that command.  That's very handy!

  --david


On Wed, May 17, 2017 at 11:48 AM, Owen Taylor <[hidden email]> wrote:
I'm not sure about your particular case, but in general, ink is not necessarily contained within the logical rectangle - there might be flourishes and tails on letters that overlap with the adjacent letters - the logical rectangle just determines spacing.

Try:
 pango-view --annotate=1 --text f --font 'DejaVu Sans Italic 80'
 pango-view --annotate=1 --text fo --font 'DejaVu Sans Italic 80'

And that should make it clear.

Owen

----- Original Message -----
> For the ink and logical rectangles returned by
> pango_layout_get_extents(), is the ink rectangle supposed to be
> contained within the logical rectangle?  I'm seeing a case where this
> doesn't seem to be the case:
>
>   text `W': ink: x=1024 y=2048 w=7168 h=6144, logical: x=0 y=0 w=7168 h=10240
>
> Here, the ink and logical rectangles have the same width (7168), but
> the ink rectangle as an x offset of 1024 whereas the logical rectangle
> has an offset of 0.  This doesn't make sense to me, but perhaps I'm
> just not understanding the API.
>
> Thanks and best regards,
>
>   --david
> _______________________________________________
> gtk-i18n-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-i18n-list
>


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