cairo: Use same scale factor as Pango, for precision and speed.
[pspp] / src / output / cairo.c
index 19a3678cc1f0d45dfda22a136b5c53ead1ac56b5..e29e6583c5f63a74fa9bc6b75d70125d09073098 100644 (file)
@@ -65,8 +65,8 @@
 #define H TABLE_HORZ
 #define V TABLE_VERT
 
-/* Measurements as we present to the rest of PSPP. */
-#define XR_POINT 1000
+/* The unit used for internal measurements is inch/(72 * XR_POINT). */
+#define XR_POINT PANGO_SCALE
 
 /* Conversions to and from points. */
 static double
@@ -315,13 +315,17 @@ xr_allocate (const char *name, int device_type, struct string_map *o)
 static int
 pango_to_xr (int pango)
 {
-  return ceil (pango * (1. * XR_POINT / PANGO_SCALE));
+  return (XR_POINT != PANGO_SCALE
+          ? ceil (pango * (1. * XR_POINT / PANGO_SCALE))
+          : pango);
 }
 
 static int
 xr_to_pango (int xr)
 {
-  return ceil (xr * (1. / XR_POINT * PANGO_SCALE));
+  return (XR_POINT != PANGO_SCALE
+          ? ceil (xr * (1. / XR_POINT * PANGO_SCALE))
+          : xr);
 }
 
 static bool