Minor edits
Compare changes
+ 8
− 5
@@ -3,19 +3,20 @@
Qt SVG has been around for basically forever, at least from the perspective of a Millennial like me. It has been a great tool to keep pixel artefacts away from our applications, a trait that has become increasingly important especially on highDPI displays. Unfortunately Qt SVG implements [SVG 1.2 Tiny](https://www.w3.org/TR/SVGTiny12/), which can be limiting in many cases.
In 2015 I defended my Master thesis and I build my presentation with the [Qt Graphics View Framework](https://doc.qt.io/qt-6/graphicsview.html) to make something that looked like [Prezi](https://prezi.com/) but with crisp LaTeX equations. I used LaTeX and [QGraphicsSvgItem](https://doc.qt.io/qt-6/qgraphicssvgitem.html) to power the equation editor of my little presentation application (This was before MathML and MathJax took over the math world). Unfortunately, LaTeX created many `<symbol>` elements that were not part of SVG 1.2 Tiny and Qt did not want to render it. I helped myself with a pipeline of tools that eventually transformed my files into valid SVG 1.2 Tiny. A rather annoying experience.
In 2015 I defended my Master thesis and I built my presentation with the [Qt Graphics View Framework](https://doc.qt.io/qt-6/graphicsview.html) to make something that looked like [Prezi](https://prezi.com/) but with crisp LaTeX equations. I used LaTeX and [QGraphicsSvgItem](https://doc.qt.io/qt-6/qgraphicssvgitem.html) to power the equation editor of my little presentation application (This was before MathML and MathJax took over the math world). Unfortunately, LaTeX created many `<symbol>` elements that were not part of SVG 1.2 Tiny and Qt did not want to render it. I helped myself with a pipeline of tools that eventually transformed my files into valid SVG 1.2 Tiny. A rather annoying experience.
I was still lucky, as symbols can be easily replaced with other SVG 1.2 Tiny elements. This is not always the case, in particular `<mask>`, `<pattern>` and `<filter>` are SVG (not SVG 1.2 Tiny) elements that cannot be emulated easily. To make things worse, these are very common elements that are used by many applications and designers without considering standards or their versions. In fact, even [QSvgGenerator](https://doc.qt.io/qt-6/qsvggenerator.html) creates masks and patterns to augment the capabilities of [QPainter](https://doc.qt.io/qt-6/qpainter.html). In short, many SVGs that cross the path of Qt SVG contain something beyond SVG Tiny and our SVG renderer is probably the sole defender of a strict SVG Tiny 1.2 standard.
I was still lucky, as symbols can be easily replaced with other SVG 1.2 Tiny elements. However, this is not always the case, especially with `<mask>`, `<pattern>` and `<filter>`, which are SVG (not SVG 1.2 Tiny) elements that cannot be emulated easily. To make things worse, these are very common elements that are used by many applications and designers without considering standards or their versions. In fact, even [QSvgGenerator](https://doc.qt.io/qt-6/qsvggenerator.html) creates masks and patterns to augment the capabilities of [QPainter](https://doc.qt.io/qt-6/qpainter.html). In short, many SVGs that cross the path of Qt SVG contain something beyond SVG Tiny and our SVG renderer is probably the sole defender of a strict SVG Tiny 1.2 standard.
In this situation it does not make much sense to stick to the standard. So when our chief-maintainer asked me to implement selected useful elements beyond SVG Tiny 1.2 I was very happy to oblige. Fast forward half a year and another release of Qt ([6.7](https://www.qt.io/blog/qt-6.7-beta1-released)) we now provide limited support for the following [SVG 1.1](https://www.w3.org/TR/SVG11/) (lower version number but no tiny here) or [SVG 2.0](https://www.w3.org/TR/SVG2/) elements:
In this situation it does not make much sense to stick to the standard. So when our chief-maintainer asked me to implement selected useful elements beyond SVG Tiny 1.2, I was very happy to oblige. Fast forward half a year and another release of Qt ([6.7](https://www.qt.io/blog/qt-6.7-beta1-released)) we now provide limited support for the following [SVG 1.1](https://www.w3.org/TR/SVG11/) (lower version number but no tiny here) or [SVG 2.0](https://www.w3.org/TR/SVG2/) elements:
We added these elements not to be compliant with SVG 1.1 or 2.0 but to deal with the most common stuff our users see. We limit our self to the most popular use cases to save us from the hassle of rewriting large amounts of code, which would be required for full support of SVG 2.0. Please keep that in mind when testing our newest SVG renderer. If you think we missed something elemental, feel free to reach out to us or comment here. Last but not least there is the [Qt Webengine module](https://doc.qt.io/qt-6/qtwebengine-overview.html) that aims to be compliant with SVG 2.0, in case you need the full standard. Qt SVG should stay a lightweight alternative to it.
We added these elements not to be compliant with SVG 1.1 or 2.0, but to deal with the most common stuff our users see. We limit our self to the most popular use cases to save us from the hassle of rewriting large amounts of code, which would be required for full support of SVG 2.0. Please keep that in mind when testing our newest SVG renderer. If you think we missed something elemental, feel free to reach out to us or comment here. Last but not least there is the [Qt Webengine module](https://doc.qt.io/qt-6/qtwebengine-overview.html) that aims to be compliant with SVG 2.0, in case you need the full standard. Qt SVG should stay a lightweight alternative to it.
@@ -89,8 +90,10 @@ Qt 6.7:
Not everything in these elements is supported. For example, we do not support `stroke="context-stroke"` or `fill="context-fill" ` in the marker element, but neither does Chromium. The filters can not use the background as input and the Gaussian blur filter looks a bit funky with a rotational transformation in combination with unequal vertical and horizontal derivation (a bug I intend to fix). We are also aware that we miss many filter primitives and one of my personal favourites, `<clipPath>`. However, with the recent change you should see a huge improvement in rendering everyday SVGs. We are about on the same level, sometimes a bit better, than most viewers I could find on Ubuntu, including inkscape. We have a new page in our documentation that keeps track of supported and unsupported elements and features.
But it gets even better, as this is just the beginning of a new era for Qt SVG. With this step we are opening Qt SVG up to support elements beyond SVG Tiny 1.2. This means that we will aim to include useful and common elements from SVG 1.1 and SVG 2.0, if maintenance is reasonably feasible. We will not aim for compliance with these standards but we will keep an eye on feature requests from our users. Further, we are open to contributions of such extensions by the community. So if you miss your favourite SVG element in the list above, fell free to drop send us some code, preferably on our [code review platform](https://codereview.qt-project.org/).
But it gets even better, as this is just the beginning of a new era for Qt SVG. With this step, we are opening Qt SVG up to support elements beyond SVG Tiny 1.2. This means that we will aim to include useful and common elements from SVG 1.1 and SVG 2.0, if maintenance is reasonably feasible. We will not aim for compliance with these standards but we will keep an eye on feature requests from our users. Further, we are open to contributions of such extensions by the community. So if you miss your favourite SVG element in the list above, fell free to drop send us some code, preferably on our [code review platform](https://codereview.qt-project.org/).
If you feel that all of this is a mistake and that we should have never left the safe haven of a well-defined standard, you can still get back the old behaviour: Just set the new property `SvgRenderer::featureSet` to `QSvg::FeatureSet::StaticTiny1_2` and our parser and renderer will ignore everything that is not included in SVG 1.2 Tiny.
\ No newline at end of file