From 18e4ab98c4c3218172df0096a65ae73b8d5ae92e Mon Sep 17 00:00:00 2001 From: Kyle Clemens Date: Wed, 7 Nov 2018 09:30:44 -0500 Subject: [PATCH] feat: set a viewBox on svg renders Instead of hard-coding a width and height, let the SVG scale according to its width and height. --- src/render/svg.rs | 2 +- src/test_annex_i_micro_qr_as_svg.svg | 2 +- src/test_annex_i_qr_as_svg.svg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render/svg.rs b/src/render/svg.rs index 847e42e..c1cd99e 100644 --- a/src/render/svg.rs +++ b/src/render/svg.rs @@ -51,7 +51,7 @@ impl<'a> RenderCanvas for Canvas<'a> { concat!( r#""#, r#""#, + r#" version="1.1" viewBox="0 0 {w} {h}" shape-rendering="crispEdges">"#, r#""#, r#" \ No newline at end of file + \ No newline at end of file diff --git a/src/test_annex_i_qr_as_svg.svg b/src/test_annex_i_qr_as_svg.svg index 72b7ff1..9b97c0f 100644 --- a/src/test_annex_i_qr_as_svg.svg +++ b/src/test_annex_i_qr_as_svg.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file