Jump to content
Sign in to follow this  
Kochab

[By Design] Firefox does not display SVGs exported by AD in a canvas

Recommended Posts

The reason is because AD assigns a width and a height to the SVG of "100%". Firefox does not allow % for width and height in a canvas. I found this info on a stackoverflow question:

https://stackoverflow.com/questions/38106906/canvas-drawimage-inline-svg-doesnt-work-on-firefox

 

After removing the %, it worked.

 

And even the w3schools's article on SVGs does not include a % or any other unit:

https://www.w3schools.com/html/html5_svg.asp

 

Chrome renders it just fine. Again, this is for canvas only. Firefox will render the SVG as is just fine when it's simply pasted into some HTML. But if you try to render it in Firefox inside a canvas, it does not render the SVG.

Share this post


Link to post
Share on other sites
9 hours ago, Kochab said:

Firefox does not allow % for width and height in a canvas.

 

So maybe, as you said, it's a problem in Firefox and not Affinity. Read the SVG specification, the percentage is a valid unit.

 

9 hours ago, Kochab said:

And even the w3schools's article on SVGs does not include a % or any other unit.

 

If only a number is specified without any unit, the number is interpreted as the number of pixels.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×