From d785ecb598691a4007a507fcac9d03feac4a528f Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Wed, 26 Jul 2017 20:34:29 +0000 Subject: [PATCH] Simplified the no-stroke declaration in SVG output code - in Java, C++, JavaScript, Python language versions. --- cpp/QrCode.cpp | 6 +++--- java/io/nayuki/qrcodegen/QrCode.java | 6 +++--- javascript/qrcodegen.js | 6 +++--- python/qrcodegen.py | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index ee668fe..bb07404 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -176,8 +176,8 @@ std::string QrCode::toSvgString(int border) const { sb << "\n"; sb << "\n"; sb << "\n"; - sb << "\t\n"; + sb << (size + border * 2) << " " << (size + border * 2) << "\" stroke=\"none\">\n"; + sb << "\t\n"; sb << "\t\n"; + sb << "\" fill=\"#000000\"/>\n"; sb << "\n"; return sb.str(); } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 4af7429..3a189aa 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -308,8 +308,8 @@ public final class QrCode { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("\n"); - sb.append(String.format("\n", size + border * 2)); - sb.append("\t\n"); + sb.append(String.format("\n", size + border * 2)); + sb.append("\t\n"); sb.append("\t\n"); + sb.append("\" fill=\"#000000\"/>\n"); sb.append("\n"); return sb.toString(); } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index f3cb9fa..14416cd 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -210,8 +210,8 @@ var qrcodegen = new function() { throw "Border must be non-negative"; var result = "\n"; result += "\n"; - result += "\n"; - result += "\t\n"; + result += "\n"; + result += "\t\n"; result += "\t\n"; + result += "\" fill=\"#000000\"/>\n"; result += "\n"; return result; }; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 9e05db8..e65957a 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -243,9 +243,9 @@ class QrCode(object): parts.append("M{},{}h1v1h-1z".format(x + border, y + border)) return """ - - - + + + """.format(self._size + border * 2, " ".join(parts))