gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: implement QR code SVG rendering


From: gnunet
Subject: [taler-merchant] branch master updated: implement QR code SVG rendering (fixed #6454)
Date: Thu, 06 Aug 2020 18:48:59 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new b4fd96d  implement QR code SVG rendering (fixed #6454)
b4fd96d is described below

commit b4fd96d263b0c71cc6b13a46c477cd96fe0af186
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Aug 6 22:18:53 2020 +0530

    implement QR code SVG rendering (fixed #6454)
---
 src/backend/taler-merchant-httpd_qr.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_qr.c 
b/src/backend/taler-merchant-httpd_qr.c
index 367a61f..ddb7316 100644
--- a/src/backend/taler-merchant-httpd_qr.c
+++ b/src/backend/taler-merchant-httpd_qr.c
@@ -72,27 +72,27 @@ TMH_create_qrcode (const char *uri)
     return NULL;
   }
   QRinput_free (qri);
-  /* FIXME-Dold: generate <img> with inline SVG instead of <pre> here! */
-  GNUNET_buffer_write_str (&buf,
-                           "<p class=\"qrtext\"><br>\n<br>\n<br>\n<br>\n");
+  GNUNET_buffer_write_fstr (&buf,
+                           "<svg width='100mm' height='100mm' viewBox='0 0 %u 
%u' "
+                           "version='1.1' xmlns='http://www.w3.org/2000/svg' "
+                           "style='shape-rendering: crispedges;'>\n",
+                           qrc->width,
+                           qrc->width);
   for (unsigned int y = 0; y<qrc->width; y++)
   {
-    GNUNET_buffer_write_str (&buf,
-                             "&nbsp;&nbsp;&nbsp;&nbsp;");
     for (unsigned int x = 0; x<qrc->width; x++)
     {
       unsigned int off = x + y * qrc->width;
+      if (0 == (qrc->data[off] & 1))
+        continue;
       GNUNET_buffer_write_fstr (&buf,
-                                "%s",
-                                (0 != (qrc->data[off] & 1))
-                                ? "██"
-                                : "&nbsp;&nbsp;");
+                                " <rect x=%u y=%u width=1 height=1 />\n",
+                                x,
+                                y);
     }
-    GNUNET_buffer_write_str (&buf,
-                             "&nbsp;&nbsp;&nbsp;&nbsp;<br>");
   }
   GNUNET_buffer_write_str (&buf,
-                           "<br>\n<br>\n<br>\n<br>\n</p>");
+                           "</svg>");
   QRcode_free (qrc);
   return GNUNET_buffer_reap_str (&buf);
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]