Jump to content
ETO

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

 

Quote

 

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

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

comma-wsp:
    (wsp+ comma? 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

working.svg

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

×

Important Information

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.