[eog: 1/2] EogImage: Use 96dpi when rendering SVG documents



commit 0c86457dc534f4958fb4ea4c3f494329b3015eb1
Author: Antonio Ospite <ao2 ao2 it>
Date:   Mon Nov 5 10:10:16 2018 +0100

    EogImage: Use 96dpi when rendering SVG documents
    
    The CSS standard specifies 96dpi as a conversion factor for units
    different than pixels:
    https://www.w3.org/TR/css3-values/#absolute-lengths
    
    This value should be assumed for SVG documents too.
    
    Other programs (Firefox, Inkscape) also use 96dpi when converting units
    of SVG files to pixels while rsvg, which EOG relies on, uses 90dpi. This
    results in EOG rendering SVG documents with different dimensions
    compared to said programs, when the original units are not in pixels.
    
    Unfortunately changing the default value in librsvg itself is not viable
    because that would break ABI compatibility, so fix the issue in EOG.
    
    Fixes #22.

 src/eog-image.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index b9688630..b67ab7c2 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -985,6 +985,11 @@ eog_image_real_load (EogImage *img,
                        file_path = g_file_get_path (priv->file);
                        rsvg_handle_set_base_uri (priv->svg, file_path);
                        g_free (file_path);
+
+                       /* Use 96dpi when rendering SVG documents with units
+                        * different then pixels. This value is specified in
+                        * the CSS standard on which SVG depends. */
+                       rsvg_handle_set_dpi_x_y (priv->svg, 96.0, 96.0);
                }
 #endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]