From 894ae9bf5c199d35f987090e4c2ed33a545d7fb0 Mon Sep 17 00:00:00 2001 From: Wenting Zhang Date: Thu, 10 Feb 2022 18:03:44 -0500 Subject: [PATCH] make svg size dynamic and responsive update SamsaGlyph.prototype.svg function so the exported SVG's width and height is set dynamically with font.unitsPerEm this helps with fonts with non-standard canvas size. use `viewBox` instead of `width` and `height` to make the svg responsive --- src/samsa-core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/samsa-core.js b/src/samsa-core.js index 9d87f8d..54c42ad 100644 --- a/src/samsa-core.js +++ b/src/samsa-core.js @@ -1138,7 +1138,7 @@ SamsaGlyph.prototype.svg = function (style={}) { + (style.fill ? ` fill="${style.fill}"` : "") + (style.stroke ? ` stroke="${style.stroke}"` : "") + (style.strokeWidth ? ` stroke-width="${style.strokeWidth}"` : ""); - return ` + return `