GarryP Posted January 6, 2021 Share Posted January 6, 2021 I have some simple SVG code (Note: ignore the viewBox attribute, it’s wrong): <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" viewBox="-0.5mm -0.5mm 11.0mm 11.0mm"> <rect x="0mm" y="0mm" width="10mm" height="10mm" stroke="black" stroke-width="1mm" fill="none" /> </svg> When I paste it into Designer, for example, from the clipboard, the rectangle has a width and height of 2.4mm and a stroke width of 0.24mm, which are the original values divided by 4.166666... However, when I place the same SVG document into my Affinity document it is shown correctly, width and height of 10mm and a stroke width of 1mm. See the attached image where the small black rectangle is the one that was pasted and the larger black rectangle is the placed embedded SVG document. Is there something I am doing wrong or is this expected behaviour? Quote Link to comment Share on other sites More sharing options...
v_kyr Posted January 6, 2021 Share Posted January 6, 2021 First there appears to be no style information associated with that shown SVG file code, you may want to add that! Further ... 45 minutes ago, GarryP said: When I paste it into Designer, for example, from the clipboard ... copied from where before pasting via the clipboard into Designer? - Behaves Ok for me via copy/paste ... screencast_svg.mp4 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
lepr Posted January 6, 2021 Share Posted January 6, 2021 In my opinion, you are doing nothing wrong and there is a bug. 4.1667 is 300/72 and there is an explanation for that ratio. Affinity apps use pixel as the internal unit of measurement, regardless of units you see in the UI. Non-pixel quantities seen in the UI are derived according to the document pixel density (misnamed as DPI instead of PPI). Your pasted SVG is specified with mm, so the resulting pixels size of the pasted Rectangle should be based on the receiving document's PPI, but the app is wrongly assuming 72 PPI regardless of the actual PPI. When you paste the SVG and the app assumes it has a pixel density of 72 PPI, 10 x 10 mm is translated to 28.346 x 28.346 pixels for the specification of the Affinity Rectangle regardless of the PPI of the receiving document. If the receiving document has 72 PPI then 28.346 pixels will be presented in the app UI as 10 mm. If the receiving document has 300 PPI then 28.346 pixels will be presented in the app UI as 2.4 mm. v_kyr 1 Quote Link to comment Share on other sites More sharing options...
v_kyr Posted January 6, 2021 Share Posted January 6, 2021 4 minutes ago, anon2 said: Affinity apps use pixel as the internal unit of measurement, regardless of units you see in the UI. Non-pixel quantities seen in the UI are derived according to the document pixel density (misnamed as DPI instead of PPI). That's right, it always coverts all other units (mm, cm, inch ... etc.) internally into pixels, which is finally what it deals with. This can also be often seen when performing doc or object position or size transformations via input boxes etc. - From GarryP's screenshot it's not visable which pixel density his document was setup in this case, but I think what @anon2 suggests is exacly the reason here for that evil behavior. - In the screenrecording above I used equal setup documents with a pixel density of 72 PPI, thus the behavior looks correct there. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
GarryP Posted January 7, 2021 Author Share Posted January 7, 2021 This is starting to make sense now, even if it’s not what I would expect. I’ve done some more experiments and all I’ve managed to do is confuse myself even more. I’ll need to look at this more closely when I get time as I’m sure I must be missing some vital understanding. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.