From 9e9ffe51ce67c7674ef35c021db12ca029851c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20F=C3=B6rster?= Date: Wed, 13 Mar 2024 12:25:13 +0100 Subject: [PATCH 1/3] harmonize `color` regex --- src/drawing-svg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drawing-svg.js b/src/drawing-svg.js index 7d94b494..d6a8c067 100644 --- a/src/drawing-svg.js +++ b/src/drawing-svg.js @@ -268,7 +268,7 @@ function DrawingSVG() { var bg = opts.backgroundcolor; return '\n' + (clips.length ? '' + clips.join('') + '' : '') + - (/^[0-9A-Fa-f]{6}$/.test(''+bg) + (/^[0-9a-fA-F]{6}$/.test(''+bg) ? '\n' : '') + linesvg + svg + '\n'; From 9758781a3674499c2f6bd7226423b0edd9e442d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20F=C3=B6rster?= Date: Fri, 15 Mar 2024 12:41:15 +0100 Subject: [PATCH 2/3] specify default height/width param. --- bwipjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bwipjs b/bwipjs index 4b4698d8..7c9f6764 100755 --- a/bwipjs +++ b/bwipjs @@ -131,9 +131,9 @@ var optlist = [ 'non-data function characters can be specified by escaped combinations such\n' + 'as ^FNC1, ^FNC4 and ^SFT.' }, { name: 'height', type: 'float', - desc: 'Height of longest bar, in millimetermillimeters.' }, + desc: 'Height of longest bar, in millimetermillimeters. Default is 25.4.' }, { name: 'width', type: 'float', - desc: 'Stretch the symbol to precisely this width, in millimeters.' }, + desc: 'Stretch the symbol to precisely this width, in millimeters. Default is 0.' }, { name: 'inkspread', type: 'float', desc: 'Amount by which to reduce the bar widths to compensate for inkspread,\n' + 'in points.' }, From fc99b1e62e71cd00d72081a1284a9ee4882a6e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20F=C3=B6rster?= Date: Fri, 15 Mar 2024 12:42:59 +0100 Subject: [PATCH 3/3] ignore SVG default `black` w/o BG --- src/drawing-svg.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/drawing-svg.js b/src/drawing-svg.js index d6a8c067..c5acf58e 100644 --- a/src/drawing-svg.js +++ b/src/drawing-svg.js @@ -18,7 +18,7 @@ function DrawingSVG() { var opts; var svg = ''; - var path; + var path = ''; var clipid = ''; var clips = []; var lines = {}; @@ -138,9 +138,6 @@ function DrawingSVG() { // orthogonal shapes. // You will see a series of polygon() calls, followed by a fill(). polygon(pts) { - if (!path) { - path = '\n'; - path = null; + // Ignore `fill` "black" if BG is "transparent" + svg += '\n'; + path = ''; } }, // Currently only used by swissqrcode. The `polys` area is an array of @@ -255,7 +251,10 @@ function DrawingSVG() { x += glyph.advance + dx; } if (path) { - svg += '\n'; + // Ignore `fill` "black" if BG is "transparent" + svg += '\n'; } }, // Called after all drawing is complete. The return value from this method