Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: In exported SVG's, wrap symbols in <symbol> element instead of <g> and <use /> them from main content, for Inkscape integration #6359

Open
roel-v opened this issue Mar 15, 2024 · 3 comments
Labels
馃拵 enhancement New feature or request

Comments

@roel-v
Copy link

roel-v commented Mar 15, 2024

What is it that you would like to see happen? 馃

There may be a reason why this hasn't been implemented like this, but while I was working on an Inkscape-to-FS-Javascript converter, I stumbled upon all the FS symbols that are in every exported SVG in the defs sections. Things like 'logo', 'bnotch' and so on. There are also 'markers' in there already that can then be used inside Inkscape, but if all the other symbols (the ones that are now wrapped simply in elements) would instead be s, and then for each of them these was a

  <use
     xlink:href="#symbol1"
     id="use1" />

element after the 'main content' so to say (outside of the defs), then those symbols would show up in the Inkscape Symbols manager and it would be possible to use them from there when using Inkscape for pattern drafting. I could then also easily convert that back into FS Javascript code from within my converter.

I don't know if there are other implications to this in other SVG software, or if any other part of FS already depends on the current behavior, but if there are no consequences, a little touch like this would make integration in the broader tool ecosystem nicer, IMO.

Additional context

No response

@roel-v roel-v added the 馃拵 enhancement New feature or request label Mar 15, 2024
Copy link

boring-cyborg bot commented Mar 15, 2024

Thanks for opening your first issue here at FreeSewing 馃
One of our contributors should triage this soon so that it gets some attention. If it's urgent, you can join us on Discord where we tend to hang out.

@joostdecock
Copy link
Member

I'm generally in favor of facilitating integration with other tools.
We'd have to look into possible side-effects before implementing this, but on the principle, I'm on board.

joostdecock added a commit that referenced this issue Apr 28, 2024
@roel-v requested in #6359 whether we could use symbol instead of defs
to place snippets on the pattern with the use tag.

I'm not against that as such, but a symbol and a def are different
things, and an initial test (this commit) shows that there's likely to
be a bunch of knock-on effects.

Symbols have their own viewBox, but ok, we can work with that.
I've gotten it to the point where things look ok in FreeSewing, but if
you open the generated SVG in Inkscape or another pattern editor, the
symbols are all over the place.

So, I took a stab at this, but this seems to open a can of worms for
rather little gain.

Still, I'm going to report back to @roel-v as perhaps they have
arguments or ideas that could sway my opinion.
@joostdecock
Copy link
Member

@roel-v I took a stab at this in a9c0e92 but I'm not sure this is a good idea.

I have attached an SVG that is generated from that code. While it looks fine in the FreeSewing environment, it looks like it's all but fine in Inkscape or other editors.

Perhaps I'm missing something obvious here, so feel free to take a look.
However, given that:

  • Symbols have their own viewBox, so creating a snippet in a plugin now because ever so slightly harder for people
  • I needed to extend core to render these snippets

I am not feeling it. Perhaps you have some good arguments to convince me otherwise, but I'm currently leaning towards if it ain't broke, don't fix it.

freesewing-simon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃拵 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants