Jump to content

Affinity is not able to render correctly a standard SVG

Recommended Posts

Affinity is not able to open SVG files with a special syntax where some whitespaces are missing.
This syntax follows the standard SVG 1.1 so is expected that Affinity is able to read.

In the attached example an arc is wrote as:

a.65.65 0 011.109-.459

 The string 011.109 contains 3 values:

  • 0
  • 1 (a boolean is required here, it cannot be 11.109)
  • 1.109

This syntax (with missing whitespaces) follows the SVG 1.1 standard: https://www.w3.org/TR/SVG11/paths.html#PathDataBNF




The following notation is used in the Backus-Naur Form (BNF) description of the grammar for path data:*: 0 or more

  • +: 1 or more
  • ?: 0 or 1
  • (): grouping
  • |: separates alternatives
  • double quotes surround literals

    ( "A" | "a" ) wsp* elliptical-arc-argument-sequence
    | elliptical-arc-argument comma-wsp? elliptical-arc-argument-sequence
    nonnegative-number comma-wsp? nonnegative-number comma-wsp? 
        number comma-wsp flag comma-wsp? flag comma-wsp? coordinate-pair

    (wsp+ comma? wsp*) | (comma wsp*)

    (#x20 | #x9 | #xD | #xA)



The example is properly displayed on Chrome and Firefox.

This issue has been discovered using SVGO (https://github.com/svg/svgo/issues/1137)

not working.svg


Link to post
Share on other sites
  • 3 weeks later...

Yes, pretty much every SVG file that you can find anywhere will not render correctly in Affinity Designer after it has been optimised with SVGO v1.3 or above but will render correctly in all common web browsers and other software following SVG specifications.

A workaround in the meantime until this bug is fixed by the Affinity developers - if needing to edit an SVG file in Affinity that has already been run through SVGO - just open the SVG in a web browser like Chrome, then "Print to PDF" (Ctrl+P on Windows), then save the page to PDF and open it with Affinity to extract the vector graphic from the PDF which will then be correctly formatted.

Link to post
Share on other sites
  • 8 months later...
  • Moderators

We have made fixes/improvements to this area (Error parsing SVG path with optimized ARC parameters) of the program in the latest release.

The fixes and how to update are described in these forum posts.

We would appreciate you checking that this issue has now been resolved for you,

Patrick Connor
Serif Europe Ltd

There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.