Re: [svgwg] consider more involved path shapes (#754)

I have come up with a (hopefully) neat solution that can help solve these kinds of problems (supposedly) very cleanly.

The core of my idea is that I think there should be a way to fragment path data, in order to be able to reuse it.

I have thought about the semantics and syntax for quite a while, and this is the best I was able to come up with.

The idea would be to introduce a new element: `fragment` (or just `frag`, perhaps). The element would have a `d` attribute, just like `path`, but it wouldn’t be rendered in any way.

~~~HTML
<fragment d="..." id="my-fragment" />
~~~

It would, then, be possible to use these elements from other fragments or from paths by using a CSS `url` function within their `d` attribute.

~~~HTML
<path
 d="
  M 0 0
  Q 1 0 1 1
  ...
  url('#my-fragment')
  L 1 1
  ...
  Z
 "
/>
~~~

Then, a lot of the troubles I was having would be able to be solved by separating parts of my paths into fragments, and using only some of them for stroking, and some of them for filling.

Somewhat related issues: #72, #285

-- 
GitHub Notification of comment by Zambonifofex
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/754#issuecomment-557349765 using your GitHub account

Received on Friday, 22 November 2019 01:42:08 UTC