diff --git a/src/ag-chart.c b/src/ag-chart.c index 66a59b7..9b64ba0 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -1393,7 +1393,11 @@ ag_chart_sort_planets_by_position(GswePlanetData *planet1, } gchar * -ag_chart_create_svg(AgChart *chart, gsize *length, GError **err) +ag_chart_create_svg( + AgChart *chart, + gsize *length, + gboolean rendering, + GError **err) { xmlDocPtr doc = create_save_doc(chart), xslt_doc, @@ -1406,7 +1410,8 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err) antiscia_node = NULL, node = NULL; gchar *value, - *save_content = NULL; + *save_content = NULL, + **params; const gchar *xslt_content; GList *houses, *house, @@ -1710,15 +1715,22 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err) return NULL; } + params = g_new0(gchar *, 3); + params[0] = "rendering"; + params[1] = (rendering) ? "'yes'" : "'no'"; + // libxml2 messes up the output, as it prints decimal floating point // numbers in a localized format. It is not good in locales that use a // character for decimal separator other than a dot. So let's just use the // C locale until the SVG is generated. current_locale = uselocale(newlocale(LC_ALL, "C", 0)); - svg_doc = xsltApplyStylesheet(xslt_proc, doc, NULL); + + svg_doc = xsltApplyStylesheet(xslt_proc, doc, (const char **)params); + uselocale(current_locale); xsltFreeStylesheet(xslt_proc); xmlFreeDoc(doc); + g_free(params); // Now, svg_doc contains the generated SVG file @@ -1752,7 +1764,7 @@ ag_chart_export_svg_to_file(AgChart *chart, GFile *file, GError **err) gchar *svg; gsize length; - if ((svg = ag_chart_create_svg(chart, &length, err)) == NULL) { + if ((svg = ag_chart_create_svg(chart, &length, TRUE, err)) == NULL) { return; } diff --git a/src/ag-chart.h b/src/ag-chart.h index 03bb0d6..8149d73 100644 --- a/src/ag-chart.h +++ b/src/ag-chart.h @@ -84,9 +84,10 @@ void ag_chart_set_city(AgChart *chart, const gchar *ag_chart_get_city(AgChart *chart); -gchar *ag_chart_create_svg(AgChart *chart, - gsize *length, - GError **err); +gchar *ag_chart_create_svg(AgChart *chart, + gsize *length, + gboolean rendering, + GError **err); GList *ag_chart_get_planets(AgChart *chart); diff --git a/src/ag-window.c b/src/ag-window.c index 91f6dc9..b115a6b 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -496,6 +496,7 @@ ag_window_redraw_chart(AgWindow *window) gchar *svg_content = ag_chart_create_svg( priv->chart, &length, + FALSE, &err ); diff --git a/src/resources/ui/chart-default.css b/src/resources/ui/chart-default.css index cb74e88..dd3413f 100644 --- a/src/resources/ui/chart-default.css +++ b/src/resources/ui/chart-default.css @@ -134,3 +134,7 @@ line.antiscion { stroke: #000000; stroke-dasharray: 20,10; } + +#background { + fill: #ffffff; +} diff --git a/src/resources/ui/chart-default.xsl b/src/resources/ui/chart-default.xsl index cdbe30d..552d744 100644 --- a/src/resources/ui/chart-default.xsl +++ b/src/resources/ui/chart-default.xsl @@ -69,6 +69,15 @@ version="1.0"> + + + + + + + <xsl:value-of select="concat( 'Natal chart of ', @@ -116,6 +125,16 @@ <polygon points="0.0,0.0 7.0,-2.0 5.0,0.0 7.0,2.0" /> </marker> </defs> + + <xsl:choose> + <xsl:when test="$rendering='yes'"> + <rect id="background" x="0" y="0"> + <xsl:attribute name="width"><xsl:value-of select="$image_size"/></xsl:attribute> + <xsl:attribute name="height"><xsl:value-of select="$image_size"/></xsl:attribute> + </rect> + </xsl:when> + </xsl:choose> + <g id="chart"> <xsl:attribute name="transform"><xsl:value-of select="concat('translate(', $image_size div 2, ',', $image_size div 2, ')')" /></xsl:attribute> <g id="moonless_chart">