From 78500062ff650ba1ce65785992abd54a3c53d9c7 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Tue, 12 Apr 2016 18:05:48 +0200 Subject: [PATCH] Fix exported SVG for SVG viewers * `sans-serif` breaks certain SVG viewers * set single font: Arial (hopefully best choice) * set absolute width and height * remove react id attributes (saves 10%) Fixes #1144 --- client/app/scripts/utils/file-utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/app/scripts/utils/file-utils.js b/client/app/scripts/utils/file-utils.js index a2be9f77c..78dd2efc0 100644 --- a/client/app/scripts/utils/file-utils.js +++ b/client/app/scripts/utils/file-utils.js @@ -25,6 +25,7 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) { } }); targetEl.setAttribute('style', computedStyleStr); + targetEl.removeAttribute('data-reactid'); } function traverse(obj) { @@ -60,7 +61,11 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) { } // set font - target.setAttribute('style', 'font-family: "Roboto", sans-serif;'); + target.setAttribute('style', 'font-family: Arial;'); + + // set view box + target.setAttribute('width', svg.clientWidth); + target.setAttribute('height', svg.clientHeight); } function download(source, name) {