summaryrefslogtreecommitdiff
path: root/pango/pango-types.h
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-07-08 19:30:45 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-07-08 19:30:45 +0000
commit7fe9544383b46f8c68671d8b41ad3f55c76bb515 (patch)
tree2bcc7b0d289a11da069843f0bc13d7cc72d09aab /pango/pango-types.h
parent39833750298d6c102f05331f41fe6bd33c5ffb9a (diff)
downloadpango-7fe9544383b46f8c68671d8b41ad3f55c76bb515.tar.gz
Add pango_context_get_font_map()
Thu Jul 8 15:25:29 2004 Owen Taylor <otaylor@redhat.com> * pango/pango-context.[ch]: Add pango_context_get_font_map() * pango/pango-fonts.c pango/pango-fontset.c pango/pango-context.c: Some s/PangoMetrics/PangoFontMetrics/ in docs. * pango/pango-context.c: Fix problem with unsetting the matrix for a context. * pango/pango-types.h: Switch to a much more efficient implementation of PANGO_SCALE.
Diffstat (limited to 'pango/pango-types.h')
-rw-r--r--pango/pango-types.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/pango/pango-types.h b/pango/pango-types.h
index e2168866..e7c64f7f 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -111,9 +111,13 @@ void pango_matrix_concat (PangoMatrix *matrix,
PangoMatrix *new_matrix);
#define PANGO_SCALE 1024
-#define PANGO_PIXELS(d) (((d) >= 0) ? \
- ((d) + PANGO_SCALE / 2) / PANGO_SCALE : \
- ((d) - PANGO_SCALE / 2) / PANGO_SCALE)
+#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
+ * integers and floating point.
+ */
/* Macros to translate from extents rectangles to ascent/descent/lbearing/rbearing
*/