From 5dba994102a251554b97f2d8dc5d08021d99f475 Mon Sep 17 00:00:00 2001 From: Laurent Alonso Date: Mon, 26 Aug 2013 09:50:05 +0200 Subject: Fix dasharray --- src/lib/VSDSVGGenerator.cpp | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/lib/VSDSVGGenerator.cpp b/src/lib/VSDSVGGenerator.cpp index 1dda1ed..a133571 100644 --- a/src/lib/VSDSVGGenerator.cpp +++ b/src/lib/VSDSVGGenerator.cpp @@ -467,58 +467,42 @@ void VSDSVGGeneratorPrivate::writeStyle(bool /* isClosed */) int dots1 = m_style["draw:dots1"] ? m_style["draw:dots1"]->getInt() : 0; int dots2 = m_style["draw:dots2"] ? m_style["draw:dots2"]->getInt() : 0; double dots1len = 72.*width, dots2len = 72.*width, gap = 72.*width; - std::string dots1lenUnit="", dots2lenUnit="", gapUnit=""; if (m_style["draw:dots1-length"]) { - dots1len = m_style["draw:dots1-length"]->getDouble(); + dots1len = 72.*m_style["draw:dots1-length"]->getDouble(); std::string str = m_style["draw:dots1-length"]->getStr().cstr(); if (str.size() > 1 && str[str.size()-1]=='%') - { - dots1len *=100.; - dots1lenUnit="%"; - } - else - dots1len *=72.; + dots1len *=width; } if (m_style["draw:dots2-length"]) { - dots2len = m_style["draw:dots2-length"]->getDouble(); + dots2len = 72.*m_style["draw:dots2-length"]->getDouble(); std::string str = m_style["draw:dots2-length"]->getStr().cstr(); if (str.size() > 1 && str[str.size()-1]=='%') - { - dots2len *=100.; - dots2lenUnit="%"; - } - else - dots2len *=72.; + dots2len *=width; } if (m_style["draw:distance"]) { - gap = m_style["draw:distance"]->getDouble(); + gap = 72.*m_style["draw:distance"]->getDouble(); std::string str = m_style["draw:distance"]->getStr().cstr(); if (str.size() > 1 && str[str.size()-1]=='%') - { - gap *=100.; - gapUnit="%"; - } - else - gap *=72.; + gap *=width; } m_outputSink << "stroke-dasharray: "; for (int i = 0; i < dots1; i++) { if (i) m_outputSink << ", "; - m_outputSink << doubleToString(dots1len) << dots1lenUnit; + m_outputSink << doubleToString(dots1len); m_outputSink << ", "; - m_outputSink << doubleToString(gap) << gapUnit; + m_outputSink << doubleToString(gap); } for (int j = 0; j < dots2; j++) { m_outputSink << ", "; - m_outputSink << doubleToString(dots2len) << dots2lenUnit; + m_outputSink << doubleToString(dots2len); m_outputSink << ", "; - m_outputSink << doubleToString(gap) << gapUnit; + m_outputSink << doubleToString(gap); } m_outputSink << "; "; } -- cgit v1.2.3