diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2008-01-22 02:08:36 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2008-01-22 02:08:36 +0000 |
commit | 792cb2621ea727020f361675f7637ce1207734c9 (patch) | |
tree | dd9fcd088ee4b6451939b385eae1899268cba0ca /pango/pango-layout.c | |
parent | 8eb3f4c814f512aaae70b080ec7d9acff1495f5b (diff) | |
download | pango-792cb2621ea727020f361675f7637ce1207734c9.tar.gz |
Bug 508002 – change pango_layout_pixel_extents() to round logical rect
2008-01-21 Behdad Esfahbod <behdad@gnome.org>
Bug 508002 – change pango_layout_pixel_extents() to round logical rect
to be inclusive
* pango/pango-layout.c (pango_layout_get_pixel_extents),
(pango_layout_line_get_pixel_extents): Round extents to pixels
inclusively. That is, pass both ink_rect and logical_rect as first
argument to pango_extents_to_pixels().
* pango/pango-matrix.c (pango_matrix_transform_pixel_rectangle):
Fix rounding.
* pango/pango-types.h:
* docs/tmpl/glyphs.sgml:
* pango/pango-utils.c (pango_extents_to_pixels):
Rename pango_extents_to_pixels() function arguments from @ink_rect and
@logical_rect to @inclusive and @nearest. Given that this API is a
fairly new addition and not commonly used, language bindings are
encouraged to update their argument names accordingly. Moreover, they
are encouraged to wrap this function as two different calls:
extents_to_pixels_inclusive() and extents_to_pixels_nearest(), or
similar conventions that best reflect their native language.
svn path=/trunk/; revision=2548
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 235f0731..c1c79999 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2576,12 +2576,9 @@ pango_layout_get_extents (PangoLayout *layout, * * Computes the logical and ink extents of @layout in device units. * This function just calls pango_layout_get_extents() followed by - * pango_extents_to_pixels(). - * - * See pango_extents_to_pixels() for details of how ink and logical rectangles - * are rounded to pixels. In certain situations you may want to use - * pango_layout_get_extents() directly and pass the resulting logical - * rectangle to pango_extents_to_pixels() as an ink rectangle(). + * two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect + * such that the rounded rectangles fully contain the unrounded one (that is, + * passes them as first argument to pango_extents_to_pixels()). **/ void pango_layout_get_pixel_extents (PangoLayout *layout, @@ -2591,7 +2588,8 @@ pango_layout_get_pixel_extents (PangoLayout *layout, g_return_if_fail (PANGO_IS_LAYOUT (layout)); pango_layout_get_extents (layout, ink_rect, logical_rect); - pango_extents_to_pixels (ink_rect, logical_rect); + pango_extents_to_pixels (ink_rect, NULL); + pango_extents_to_pixels (logical_rect, NULL); } /** @@ -4610,7 +4608,9 @@ pango_layout_line_new (PangoLayout *layout) * * Computes the logical and ink extents of @layout_line in device units. * This function just calls pango_layout_line_get_extents() followed by - * pango_extents_to_pixels(). + * two pango_extents_to_pixels() calls, rounding @ink_rect and @logical_rect + * such that the rounded rectangles fully contain the unrounded one (that is, + * passes them as first argument to pango_extents_to_pixels()). **/ void pango_layout_line_get_pixel_extents (PangoLayoutLine *layout_line, @@ -4620,7 +4620,8 @@ pango_layout_line_get_pixel_extents (PangoLayoutLine *layout_line, g_return_if_fail (LINE_IS_VALID (layout_line)); pango_layout_line_get_extents (layout_line, ink_rect, logical_rect); - pango_extents_to_pixels (ink_rect, logical_rect); + pango_extents_to_pixels (ink_rect, NULL); + pango_extents_to_pixels (logical_rect, NULL); } /* |