Re: [svgwg] fill-rule Could Use Some Clarification

@AmeliaBR 
> fill-rule is not merely an attribute; it is an inheritable style property and presentation attribute. It can be defined on any SVG-namespaced element in SVG 2, and most SVG-namespaced elements in SVG 1.1 regardless of whether or not it has an effect on that element. In particular, it has always been valid as an attribute on <g>; however, as @svgeesus explained, it does not apply at the group level, but by inheriting down to individual shape and text elements (just like the fill or stroke properties do). It would therefore be unacceptable to change its behavior.

Good to know; I wasn’t aware of this detail. So `<g fill-rule="evenodd"/>` is valid even though the `fill-rule` rule CSS property has no effect on `g` elements.

>The "Applies to" section of the fill-rule definition could be narrowed to only list the elements on which it would ever have a visible effect, since "Applies to" defines which elements actually use the style property. However, I personally see that as unnecessarily complicating matters. The fill-rule applies to a <circle> in the exact same way that it applies to a <path> element describing the same circular shape. It is OK that definition of fill-rule refers specifically to paths, because all the basic shapes are now defined in terms of "equivalent paths".

I think the “Applies to” section should be narrowed. As it stands, it implies that code like `<circle … fill-rule="evenodd"/>` should do something even though this is guaranteed to do nothing.

At the very least, I think an explanation in the specification should be added to indicate why elements like `circle` are listed to avoid confusion (as indicated by item (B) in my previous post).

>I do agree that it would be very nice if SVG had a feature for creating compound shapes that are the intersection or union of multiple simple shapes. But that is quite a more complicated matter than what fill-rule can do.

In light of the `fill-rule` CSS property already applying to `g` elements, I’d guess it’s out of the question to redefine `fill-rule` to apply to `g` elements as a union of its child or descendant shapes because of backward-compatibility concerns.

> The application of fill-rule to text does need to be clarified.

> In the Text chapter, we currently have an informative note that says "Since the fill-rule property does not apply to SVG text elements, the specific order of the subpaths within the equivalent path does not matter." That contradicts the fill-rule definition that says it does apply to text content elements. We need to decide which one it is (probably by testing current SVG implementations to see what they are doing), and we definitely need some tests to match.

>There should also be tests for fill-rule and <polygon> and <polyline>, and maybe (for completeness) the other basic shapes.

I have to wonder whether this is leftover functionality from when SVG Fonts were still a thing.

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

Received on Monday, 18 September 2017 22:33:46 UTC