MmmMaarten Posted March 24, 2021 Share Posted March 24, 2021 When having a space (at the end) of a layer name and exporting to svg, Designer doesn't trim the layername when setting it in the svg's id attribute. Resulting in an illegal (non-working) id. I don't believe pre- and postfix spaces will be ever usefull and especially while naming hundreds of layers a mistake by entering a non-wanting space there is made very quickly, but pretty much impossible to spot in the editor. This results in different IDs in the svg output though, making the elements not be found by code, as these 'invisible' spaces are replaced by hyphens (which is great with inbetween spaces, but not with post- and prefix spaces). Could Designer please always trim pre- and postfix spaces in layer names directly after entering them? Quote Link to comment Share on other sites More sharing options...
Staff Sean P Posted March 24, 2021 Staff Share Posted March 24, 2021 Hi wigglepixel, As far as I can see the actual space is stripped away and replaced with a hyphen in the actual 'ID' entry that matters. If you've got a document that this is failing with on export then by all means please do attach it. It was reported a while back that IDs were including spaces if the layer name contained a space, so it decided to change the space to a hyphen to stop the illegal ids. However we also retained the original layer name using 'serif:id' which is used on import back into Affinity so your layer names still contain spaces. Quote Link to comment Share on other sites More sharing options...
MmmMaarten Posted March 24, 2021 Author Share Posted March 24, 2021 12 minutes ago, Sean P said: Hi wigglepixel, As far as I can see the actual space is stripped away and replaced with a hyphen in the actual 'ID' entry that matters. If you've got a document that this is failing with on export then by all means please do attach it. It was reported a while back that IDs were including spaces if the layer name contained a space, so it decided to change the space to a hyphen to stop the illegal ids. However we also retained the original layer name using 'serif:id' which is used on import back into Affinity so your layer names still contain spaces. Thanks for your quick response. Ah, I believe you're right. I remember I've seen a hyphen along in the process. So probably I 'automatically' replaced the hyphen and forgot about it. Sorry for the inconvinience. So just changed the opening post. There's still the thing about spaces in the layer names though. We cannot see them in the editor, so accidentely entered spaces in the layer names are difficult/not to spot in the editor, but are a pain in the resulting SVG when programming as the IDs suddenly are different (just found out the hard way with a few hundred layers here, where chances were higher that by accident a space was entered in some of these layers. These issues are very difficult/impossible to spot in the editor) Is there a reason why leading and trailing spaces aren't trimmed from layernames inside Designer? Quote Link to comment Share on other sites More sharing options...
Staff Sean P Posted March 24, 2021 Staff Share Posted March 24, 2021 3 minutes ago, wigglepixel said: Ah, you might be right. I indeed saw a hyphen along in the process. So probably I 'automatically' replaced the hyphen. Sorry for the inconvinience. There's still the thing about spaces in the layer names though. We cannot see them in the editor, so accidentely entered spaces in the layer names are difficult/not to spot in the editor (just found out the hard way with a few hundred layers here, where chances are higher that by accident a space was entered in some of these layers) Is there a reason why leading and trailing spaces aren't trimmed from layernames inside Designer though? There is no specific reason I'm aware of, but we do risk breaking workflow for other users if we do this, as the SVG format is quite versatile. Quote Link to comment Share on other sites More sharing options...
MmmMaarten Posted March 24, 2021 Author Share Posted March 24, 2021 18 minutes ago, Sean P said: There is no specific reason I'm aware of, but we do risk breaking workflow for other users if we do this, as the SVG format is quite versatile. Just to be clear that we don't have a misunderstanding; I'm not talking about middle spaces (inbetween spaces), but leading and trailing spaces of the layer names. I can't think of a workflow of people using leading and trailing spaces we cannot see in the editor anyhow (definitely not the trailing spaces), but let's say there is a useful workflow to use them; could you guys please consider to add a setting to automatically strip them during entering (or when exporting) as these are error prone when programming with svg's and lots of layers and I don't see any way to spot issues with spaces now in the editor without clicking all hundred layers one by one, which does't only take a loooong time and is boring, but also is errror prone by itself, as it's active for changes again? Please consider this, it doesn't seem like a major change, but it makes a difference of hours of work here. Just a quick demo to illustrate this This is a layername without a trailing space: And this is a layername with a trailing space: I don't know about other people, but for me it's pretty much impossible to spot, especially when having hundreds of layers in a file and inside groups all with different names. I can't spot the difference even when directly looking at it. But one of these names is wrong as the space got there by accident and is now messing up the workflow in svg. Quote Link to comment Share on other sites More sharing options...
Staff Sean P Posted March 24, 2021 Staff Share Posted March 24, 2021 Thanks, I shall get pass it on to development to consider MmmMaarten 1 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.