[cairo-commit] libsvg-cairo/src svg_cairo.c,1.42,1.43

Jason Dorje Short commit at pdx.freedesktop.org
Sat Aug 13 00:06:04 PDT 2005


Committed by: jdorje

Update of /cvs/cairo/libsvg-cairo/src
In directory gabe:/tmp/cvs-serv25720/src

Modified Files:
	svg_cairo.c 
Log Message:
Use svg_get_dpi to query the DPI rather than assuming it to be 100.


Index: svg_cairo.c
===================================================================
RCS file: /cvs/cairo/libsvg-cairo/src/svg_cairo.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- svg_cairo.c	27 Jul 2005 17:23:09 -0000	1.42
+++ svg_cairo.c	13 Aug 2005 07:06:02 -0000	1.43
@@ -1448,7 +1448,10 @@
     return SVG_STATUS_SUCCESS;
 }
 
-#define	DPI	100.0 // This is NOT what we want. How to reach global DPI? (Rob)
+/* svg_get_dpi queries the current DPI but libsvg-cairo has no mechanism
+   for setting this DPI.  Thus we have to assume that libsvg gets it right;
+   there's no way for users to control it. */
+#define	DPI(svg) svg_get_dpi(svg)
 
 static double
 _svg_cairo_text_size (svg_cairo_t *svg_cairo)
@@ -1471,19 +1474,19 @@
 	*pixel = length->value;
 	break;
     case SVG_LENGTH_UNIT_CM:
-	*pixel = (length->value / 2.54) * DPI;
+        *pixel = (length->value / 2.54) * DPI(svg_cairo->svg);
 	break;
     case SVG_LENGTH_UNIT_MM:
-	*pixel = (length->value / 25.4) * DPI;
+	*pixel = (length->value / 25.4) * DPI(svg_cairo->svg);
 	break;
     case SVG_LENGTH_UNIT_IN:
-	*pixel = length->value * DPI;
+	*pixel = length->value * DPI(svg_cairo->svg);
 	break;
     case SVG_LENGTH_UNIT_PT:
-	*pixel = (length->value / 72.0) * DPI;
+	*pixel = (length->value / 72.0) * DPI(svg_cairo->svg);
 	break;
     case SVG_LENGTH_UNIT_PC:
-	*pixel = (length->value / 6.0) * DPI;
+	*pixel = (length->value / 6.0) * DPI(svg_cairo->svg);
 	break;
     case SVG_LENGTH_UNIT_EM:
 	*pixel = length->value * _svg_cairo_text_size (svg_cairo);




More information about the cairo-commit mailing list