svg-native-viewer
svg-native-viewer copied to clipboard
Support SVGUseElement child within SVGClipPathElement?
SVG 1.1 allows a <use>
element within a <clipPath>
element as long as the reference chain ends with an SVGShapeElement.
As far as I recall, SVG Native wasn't supposed to support an SVGUseElement as child. However, the spec does not disallow it. @litherum, is this an issue in the spec or is a SVGUseElement child supported in SVG Native?
I would also like to know the answer to this question.
In our nanoemoji color font compiler we would like to use <use>
element to reuse similar shapes within/across glyphs to reduce the file size.
However, neither Adobe apps nor Safari seem to like that:
https://github.com/googlefonts/nanoemoji/issues/264#issuecomment-817983791
https://github.com/googlefonts/nanoemoji/issues/266#issuecomment-817975544
@dirkschulze question was specifically about allowing <use>
element within a <clipPath>
. My question is more general, is <use>
actually supported at all, not just as a child of <clipPath>
?
@anthrotype Yes, <use>
is supported in general. I can not speak for the macOS/Safari implementation but to my knowledge this is the case for Safari and its OT-SVG fonts implementation as well. I am unsure why Adobe Illustrator is not able to render your file as expected. This might be an issue in the used SVG parser or the with the SVG content itself.
as @litherum pointed out, we are using the unqualified href
attribute whereas Safari expects the xlink:href
(with appropriate xmlns declared) which the spec says it's deprecated, but apparently is still valid for SVG 1.1 content.
https://github.com/googlefonts/nanoemoji/issues/266#issuecomment-818289140
@dirkschulze I would like to point out that NotoColorEmoji glyphs have a use
element inside a clipPath
element and it's very common. Given that it's so common, we'd like to have support for this.
90% of the glyphs
that's a lot, where/how did you get those metrics?
I should make a correction, it's not 90% and I don't have an exact metric. I iterated through ~3000 of those glyphs manually and almost every other glyph would not render properly due to this limitation of SNV. So it's a lot of glyphs but definitely not 90%. I confused this with another problem of SNV which I've pointed out in #154. That affected almost every glyph in NotoColor. Thanks for pointing out. :laughing: