[cairo-commit] libsvg/src svg.c,1.12,1.13 svg.h,1.23,1.24

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


Committed by: jdorje

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

Modified Files:
	svg.c svg.h 
Log Message:
Change default DPI to 90, and provide a new function to query the
current DPI.


Index: svg.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- svg.c	11 Apr 2005 16:20:09 -0000	1.12
+++ svg.c	13 Aug 2005 07:00:13 -0000	1.13
@@ -47,7 +47,14 @@
 static svg_status_t
 _svg_init (svg_t *svg)
 {
-    svg->dpi = 100;
+    /* This value is just a guess; if it's wrong the SVG may be rendered
+       incorrectly.  But there's no way to make a better guess. */
+    /* 90 DPI is supposed to be the default for SVG files; see 
+       http://www.w3.org/TR/REC-CSS2/syndata.html .  Good SVG files should
+       not mix units, so units are given all in DPI or all in lengths.  Many
+       "bad" SVG files do mix units however and so knowing the correct DPI
+       is needed to render them correctly.  See svg_get_dpi. */
+    svg->dpi = 90.0;
 
     svg->dir_name = strdup (".");
 
@@ -244,6 +251,16 @@
     return SVG_STATUS_SUCCESS;
 }
 
+/* Returns the current DPI.  For now this is generated internally in
+   _svg_init and is constant.  Later it may be possible for the user
+   to choose the DPI (to render a 5 inch SVG file properly for printing
+   on a 300DPI printer, for instance). */
+double
+svg_get_dpi (svg_t *svg)
+{
+    return svg->dpi;
+}
+
 void
 svg_get_size (svg_t *svg, svg_length_t *width, svg_length_t *height)
 {

Index: svg.h
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- svg.h	19 Jul 2005 16:56:00 -0000	1.23
+++ svg.h	13 Aug 2005 07:00:13 -0000	1.24
@@ -348,6 +348,9 @@
 	    svg_render_engine_t	*engine,
 	    void		*closure);
 
+double
+svg_get_dpi (svg_t *svg);
+
 void
 svg_get_size (svg_t *svg,
 	      svg_length_t *width,




More information about the cairo-commit mailing list