diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-04-29 19:41:23 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-04-29 19:41:23 +0000 |
commit | dd69229f4e5bea613aec846d9964edc7d2683825 (patch) | |
tree | 96e68e3f2770bb47cc68669d8eb352845a7403ac /pango/pango-types.h | |
parent | 58493b0080dc8d91e09b8b9ec05f910388730047 (diff) | |
download | pango-dd69229f4e5bea613aec846d9964edc7d2683825.tar.gz |
Bug 329547 – pango_layout_get_pixel_extents and
2006-04-29 Behdad Esfahbod <behdad@gnome.org>
Bug 329547 – pango_layout_get_pixel_extents and
pango_layout_get_pixel_size cause off-by-one metrics
* docs/pango-sections.txt:
* docs/tmpl/glyphs.sgml:
* pango/pango-types.h: Define PANGO_PIXELS_FLOOR and
* PANGO_PIXELS_CEIL.
* pango/pango-layout.c (pango_layout_get_pixel_extents),
(pango_layout_get_pixel_size): Make sure logical rects are
consistent and ink rects are inclusive.
Diffstat (limited to 'pango/pango-types.h')
-rw-r--r-- | pango/pango-types.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pango/pango-types.h b/pango/pango-types.h index 6a198a60..980658a3 100644 --- a/pango/pango-types.h +++ b/pango/pango-types.h @@ -127,10 +127,12 @@ double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix); #define PANGO_SCALE 1024 #define PANGO_PIXELS(d) (((int)(d) + 512) >> 10) -/* The above expression is just slightly wrong for floating point d; - * We'd expect -512.5 => -1 but instead we get 0. That's unlikely - * to matter for practical use and the expression is much more - * compact and faster than alternatives that work exactly for both +#define PANGO_PIXELS_FLOOR(d) (((int)(d)) >> 10) +#define PANGO_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10) +/* The above expressions are just slightly wrong for floating point d; + * For example we'd expect PANGO_PIXELS(-512.5) => -1 but instead we get 0. + * That's unlikely to matter for practical use and the expression is much + * more compact and faster than alternatives that work exactly for both * integers and floating point. */ |