SVGHMI: ensure that coordinate in CSV file generated by inkscape are both matching svg default unit and in default reference frame
--- a/svghmi/gen_index_xhtml.xslt Thu Feb 13 09:43:35 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Fri Feb 14 10:29:10 2020 +0100
@@ -116,6 +116,16 @@
<xsl:apply-templates mode="inline_svg" select="@* | node()"/>
</xsl:copy>
</xsl:template>
+ <xsl:template mode="inline_svg" match="svg:svg[@viewBox!=concat('0 0 ', @width, ' ', @height)]">
+ <xsl:message terminate="yes">
+ <xsl:text>Scale other than 1.000 in Inkscape's document properties is not supported</xsl:text>
+ </xsl:message>
+ </xsl:template>
+ <xsl:template mode="inline_svg" match="sodipodi:namedview[@units!='px' or @inkscape:document-units!='px']">
+ <xsl:message terminate="yes">
+ <xsl:text>All units must be set to "px" in Inkscape's document properties</xsl:text>
+ </xsl:message>
+ </xsl:template>
<xsl:template match="/">
<xsl:comment>
<xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
--- a/svghmi/gen_index_xhtml.ysl2 Thu Feb 13 09:43:35 2020 +0100
+++ b/svghmi/gen_index_xhtml.ysl2 Fri Feb 14 10:29:10 2020 +0100
@@ -121,6 +121,14 @@
attrib "width" > 100vw
apply "@* | node()", mode="inline_svg";
}
+ /* ensure that coordinate in CSV file generated by inkscape are in default reference frame */
+ template "svg:svg[@viewBox!=concat('0 0 ', @width, ' ', @height)]", mode="inline_svg" {
+ error > ViewBox settings other than X=0, Y=0 and Scale=1 are not supported
+ }
+ /* ensure that coordinate in CSV file generated by inkscape match svg default unit */
+ template "sodipodi:namedview[@units!='px' or @inkscape:document-units!='px']", mode="inline_svg" {
+ error > All units must be set to "px" in Inkscape's document properties
+ }
/*const "mark" > =HMI=\n*/