diff --git a/src/Mod/TechDraw/Gui/QGIFace.cpp b/src/Mod/TechDraw/Gui/QGIFace.cpp index b66f57f129..cbd840cfe6 100644 --- a/src/Mod/TechDraw/Gui/QGIFace.cpp +++ b/src/Mod/TechDraw/Gui/QGIFace.cpp @@ -59,6 +59,7 @@ // #include "Rez.h" #include "DrawGuiUtil.h" +#include #include "QGCustomSvg.h" #include "QGCustomImage.h" #include "QGCustomRect.h" @@ -222,6 +223,17 @@ void QGIFace::loadSvgHatch(std::string fileSpec) return; } m_svgXML = f.readAll(); + + // search in the file for the "stroke" specifiction in order to find out what specification style is used + // this is necessary to apply a color set by the user to the SVG + QByteArray pattern("stroke:"); + QByteArrayMatcher matcher(pattern); + int pos = 0; + if ((pos = matcher.indexIn(m_svgXML, pos)) != -1) + SVGCOLPREFIX = "stroke:"; // declaration part of a style= statement + else + SVGCOLPREFIX = "stroke=\""; // declaration of its own + if (!m_svg->load(&m_svgXML)) { Base::Console().Error("Error - Could not load hatch into SVG renderer for %s\n", fileSpec.c_str()); return; diff --git a/src/Mod/TechDraw/Gui/QGIFace.h b/src/Mod/TechDraw/Gui/QGIFace.h index a7f5c3f355..2d6614ed0c 100644 --- a/src/Mod/TechDraw/Gui/QGIFace.h +++ b/src/Mod/TechDraw/Gui/QGIFace.h @@ -44,8 +44,7 @@ class QGCustomImage; const double SVGSIZEW = 64.0; //width and height of standard FC SVG pattern const double SVGSIZEH = 64.0; - const std::string SVGCOLPREFIX = "stroke:"; - const std::string SVGCOLDEFAULT = "#000000"; + const std::string SVGCOLDEFAULT = "#000000"; class QGIFace : public QGIPrimPath { @@ -68,7 +67,7 @@ public: GeomHatchFill, PlainFill }; - + std::string SVGCOLPREFIX = ""; // will be determined on runtime int getProjIndex() const { return projIndex; }