905 lines
60 KiB
ReStructuredText
905 lines
60 KiB
ReStructuredText
Supported SVG and CSS features
|
||
==============================
|
||
|
||
Librsvg tries to be a mostly complete renderer for `SVG1.1
|
||
<https://www.w3.org/TR/SVG11/>`_ and `SVG2
|
||
<https://www.w3.org/TR/SVG2/>`_.
|
||
|
||
In terms of processing external references, librsvg is a bit more
|
||
strict than SVG’s “static mode” and a bit more lenient than “secure
|
||
static mode”. See "`Security and locations of referenced files
|
||
<https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/class.Handle.html#security-and-locations-of-referenced-files>`_"
|
||
in the reference documentation for details.
|
||
|
||
Animation, interactivity, and scripting are not supported.
|
||
|
||
The SVG1.2 specification never made it past draft status in the W3C’s
|
||
process, and librsvg does not support it. Note that SVG2 removed some of
|
||
the features proposed for SVG1.2.
|
||
|
||
Generally, librsvg tries to keep up with features in the SVG2 Candidate
|
||
Recommendation spec. It ignores features in the SVG2 drafts that are not
|
||
finalized yet.
|
||
|
||
Alternative versions of SVG (SVG Tiny, SVG Basic, :issue:`SVG Native
|
||
<689>`) are not explicitly supported. Their features which are a subset
|
||
of SVG1.1 or SVG2 are supported if they are equivalent to the ones
|
||
listed below.
|
||
|
||
SVG2 offloads many of its features to the family of CSS3 specifications.
|
||
Librsvg does not try to support them exhaustively (there are too many
|
||
features in CSS!). Instead, we try to prioritize new features based on
|
||
the needs which people express in librsvg’s bug tracker. Do you want a
|
||
feature? `File an
|
||
issue <https://gitlab.gnome.org/GNOME/librsvg/-/issues>`__!
|
||
|
||
Supported raster image formats
|
||
------------------------------
|
||
|
||
The ``image`` and ``feImage`` elements allow including an external
|
||
file as raster data. Librsvg supports loading JPEG, PNG, GIF, and
|
||
WEBP. Librsvg can optionally be compiled with support for AVIF, too;
|
||
see the "Compile-time options" section in :doc:`compiling` for details.
|
||
|
||
Attributes supported by all elements
|
||
------------------------------------
|
||
|
||
+-----------------------------------+-----------------------------------+
|
||
| Attribute | Notes |
|
||
+===================================+===================================+
|
||
| class | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| id | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| requiredExtensions | Used in children of the |
|
||
| | ``switch`` element. |
|
||
+-----------------------------------+-----------------------------------+
|
||
| requiredFeatures | Used in children of the |
|
||
| | ``switch`` element. |
|
||
+-----------------------------------+-----------------------------------+
|
||
| systemLanguage | Used in children of the |
|
||
| | ``switch`` element. |
|
||
+-----------------------------------+-----------------------------------+
|
||
| style | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| transform | The ``transform`` attribute has a |
|
||
| | different syntax than the CSS |
|
||
| | ``transform`` property. |
|
||
+-----------------------------------+-----------------------------------+
|
||
| xml:lang | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| xml:space | |
|
||
+-----------------------------------+-----------------------------------+
|
||
|
||
.. _elements:
|
||
|
||
Elements and their specific attributes
|
||
--------------------------------------
|
||
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| Element | Attributes | Notes |
|
||
+=======================+=======================+===============================+
|
||
| a | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | href | SVG2 |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| circle | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | r | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| clipPath | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | clipPathUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| defs | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| ellipse | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | rx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | ry | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feBlend | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | mode | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feColorMatrix | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | type | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | values | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feComponentTransfer | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feComposite | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | operator | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | k1 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | k2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | k3 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | k4 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feConvolveMatrix | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | order | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | divisor | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | bias | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | targetX | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | targetY | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | edgeMode | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | kernelMatrix | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | kernelUnitLength | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAlpha | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feDiffuseLighting | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | surfaceScale | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | kernelUnitLength | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | diffuseConstant | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feDisplacementMap | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | scale | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xChannelSelector | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | yChannelSelector | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feDistantLight | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | azimuth | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | elevation | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feDropShadow | | See :ref:`filter_effects` |
|
||
| | | |
|
||
| | | Also takes the |
|
||
| | | flood-color and |
|
||
| | | flood-opacity |
|
||
| | | properties. |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | stdDeviation | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feFuncA | | See |
|
||
| | | :ref:`feComponentTransfer` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feFuncB | | See |
|
||
| | | :ref:`feComponentTransfer` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feFuncG | | See |
|
||
| | | :ref:`feComponentTransfer` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feFuncR | | See |
|
||
| | | :ref:`feComponentTransfer` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feFlood | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | | Parameters come from |
|
||
| | | the flood-color and |
|
||
| | | flood-opacity |
|
||
| | | properties. |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feGaussianBlur | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | stdDeviation | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feImage | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | href | SVG2 |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | path | Non-standard; used by |
|
||
| | | old Adobe Illustrator |
|
||
| | | versions. |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feMerge | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feMergeNode | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feMorphology | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | operator | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | radius | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feOffset | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| fePointLight | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | z | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feSpecularLighting | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | surfaceScale | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | kernelUnitLength | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | specularConstant | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | specularExponent | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feSpotLight | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | z | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | pointsAtX | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | pointsAtY | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | pointsAtZ | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | specularExponent | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | limitingConeAngle | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feTile | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | in | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| feTurbulence | | See :ref:`filter_effects` |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | baseFrequency | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | numOctaves | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | seed | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | stitchTiles | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | type | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| filter | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | filterUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | primitiveUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| g | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| image | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | href | SVG2 |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | path | Non-standard; used by |
|
||
| | | old Adobe Illustrator |
|
||
| | | versions. |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| line | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x1 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y1 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| linearGradient | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | gradientUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | gradientTransform | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | spreadMethod | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x1 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y1 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y2 | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| marker | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | markerUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | refX | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | refY | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | markerWidth | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | markerHeight | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | orient | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | viewBox | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| mask | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | maskUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | maskContentUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| path | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | d | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| pattern | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | href | SVG2 |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | patternUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | patternContentUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | patternTransform | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | viewBox | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| polygon | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | points | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| polyline | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | points | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| radialGradient | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | gradientUnits | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | gradientTransform | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | spreadMethod | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | cy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | r | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | fx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | fx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | fr | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| rect | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | rx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | ry | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| stop | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | offset | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| style | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | type | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| svg | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | viewBox | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| switch | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| symbol | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | preserveAspectRatio | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | viewBox | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| text | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| tref | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| tspan | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dx | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | dy | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| use | | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | xlink:href | Needs xlink namespace |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | href | SVG2 |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | x | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | y | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | width | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
| | height | |
|
||
+-----------------------+-----------------------+-------------------------------+
|
||
|
||
CSS properties
|
||
--------------
|
||
|
||
The following are shorthand properties. They are not available as
|
||
presentation attributes, only as style properties, so for example you
|
||
have to use ``<path style="marker: url(#foo);"/>``, since there is no
|
||
``marker`` attribute.
|
||
|
||
+----------------------------+--------------------------------------------------------------------+
|
||
| Property | Notes |
|
||
+============================+====================================================================+
|
||
| font | |
|
||
+----------------------------+--------------------------------------------------------------------+
|
||
| glyph-orientation-vertical | Supports only CSS Writing Modes 3 values: auto, 0, 90, 0deg, 90deg |
|
||
+----------------------------+--------------------------------------------------------------------+
|
||
| marker | |
|
||
+----------------------------+--------------------------------------------------------------------+
|
||
|
||
The following are longhand properties. Most of them are available as
|
||
presentation attributes, e.g. you can use ``<rect fill="blue"/>`` as
|
||
well as ``<rect style="fill: blue;"/>``. The Notes column indicates
|
||
which properties are not available as presentation attributes.
|
||
|
||
+-----------------------+----------------------------------------------+
|
||
| Property | Notes |
|
||
+=======================+==============================================+
|
||
| baseline-shift | |
|
||
+-----------------------+----------------------------------------------+
|
||
| clip-path | |
|
||
+-----------------------+----------------------------------------------+
|
||
| clip-rule | |
|
||
+-----------------------+----------------------------------------------+
|
||
| color | |
|
||
+-----------------------+----------------------------------------------+
|
||
| color- | |
|
||
| interpolation-filters | |
|
||
+-----------------------+----------------------------------------------+
|
||
| direction | |
|
||
+-----------------------+----------------------------------------------+
|
||
| display | |
|
||
+-----------------------+----------------------------------------------+
|
||
| enable-background | |
|
||
+-----------------------+----------------------------------------------+
|
||
| fill | |
|
||
+-----------------------+----------------------------------------------+
|
||
| fill-opacity | |
|
||
+-----------------------+----------------------------------------------+
|
||
| fill-rule | |
|
||
+-----------------------+----------------------------------------------+
|
||
| filter | |
|
||
+-----------------------+----------------------------------------------+
|
||
| flood-color | |
|
||
+-----------------------+----------------------------------------------+
|
||
| flood-opacity | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-family | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-size | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-stretch | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-style | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-variant | |
|
||
+-----------------------+----------------------------------------------+
|
||
| font-weight | |
|
||
+-----------------------+----------------------------------------------+
|
||
| image-rendering | |
|
||
+-----------------------+----------------------------------------------+
|
||
| isolation | Not available as a presentation attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| letter-spacing | |
|
||
+-----------------------+----------------------------------------------+
|
||
| lighting-color | |
|
||
+-----------------------+----------------------------------------------+
|
||
| line-height | Not available as a presentation attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| marker-end | |
|
||
+-----------------------+----------------------------------------------+
|
||
| marker-mid | |
|
||
+-----------------------+----------------------------------------------+
|
||
| marker-start | |
|
||
+-----------------------+----------------------------------------------+
|
||
| mask | |
|
||
+-----------------------+----------------------------------------------+
|
||
| mask-type | |
|
||
+-----------------------+----------------------------------------------+
|
||
| mix-blend-mode | Not available as a presentation attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| opacity | |
|
||
+-----------------------+----------------------------------------------+
|
||
| overflow | |
|
||
+-----------------------+----------------------------------------------+
|
||
| paint-order | |
|
||
+-----------------------+----------------------------------------------+
|
||
| shape-rendering | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stop-color | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stop-opacity | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-dasharray | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-dashoffset | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-linecap | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-linejoin | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-miterlimit | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-opacity | |
|
||
+-----------------------+----------------------------------------------+
|
||
| stroke-width | |
|
||
+-----------------------+----------------------------------------------+
|
||
| text-anchor | |
|
||
+-----------------------+----------------------------------------------+
|
||
| text-decoration | |
|
||
+-----------------------+----------------------------------------------+
|
||
| text-orientation | Not available as a presentation attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| text-rendering | |
|
||
+-----------------------+----------------------------------------------+
|
||
| transform | SVG2; different syntax from the |
|
||
| | ``transform`` attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| unicode-bidi | |
|
||
+-----------------------+----------------------------------------------+
|
||
| vector-effect | Only ``non-scaling-stroke`` is supported for |
|
||
| | paths. |
|
||
+-----------------------+----------------------------------------------+
|
||
| visibility | |
|
||
+-----------------------+----------------------------------------------+
|
||
| white-space | Not available as a presentation attribute. |
|
||
+-----------------------+----------------------------------------------+
|
||
| writing-mode | |
|
||
+-----------------------+----------------------------------------------+
|
||
|
||
.. _filter_effects:
|
||
|
||
Filter effects
|
||
--------------
|
||
|
||
The following elements are filter effects:
|
||
|
||
- feBlend
|
||
- feColorMatrix
|
||
- feComponentTransfer
|
||
- feComposite
|
||
- feConvolveMatrix
|
||
- feDiffuseLighting
|
||
- feDisplacementMap
|
||
- feDropShadow
|
||
- feFlood
|
||
- feGaussianBlur
|
||
- feImage
|
||
- feMerge
|
||
- feMorphology
|
||
- feOffset
|
||
- feSpecularLighting
|
||
- feTile
|
||
- feTurbulence
|
||
|
||
All of those elements for filter effects support these attributes:
|
||
|
||
+-----------------------------------+-----------------------------------+
|
||
| Attribute | Notes |
|
||
+===================================+===================================+
|
||
| x | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| y | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| width | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| height | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| result | |
|
||
+-----------------------------------+-----------------------------------+
|
||
|
||
Some filter effect elements take one input in the ``in`` attribute, and
|
||
some others take two inputs in the ``in``, ``in2`` attributes. See the
|
||
:ref:`table of elements <elements>` above for details.
|
||
|
||
.. _feComponentTransfer:
|
||
|
||
Filter effect feComponentTransfer
|
||
---------------------------------
|
||
|
||
The ``feComponentTransfer`` element can contain children ``feFuncA``,
|
||
``feFuncR``, ``feFuncG``, ``feFuncB``, and those all support these
|
||
attributes:
|
||
|
||
=========== =====
|
||
Attribute Notes
|
||
=========== =====
|
||
type
|
||
tableValues
|
||
slope
|
||
intercept
|
||
amplitude
|
||
exponent
|
||
offset
|
||
=========== =====
|
||
|
||
CSS features
|
||
------------
|
||
|
||
Pseudo-classes
|
||
~~~~~~~~~~~~~~
|
||
|
||
+-----------------------------------+-----------------------------------+
|
||
| Pseudo-class | Notes |
|
||
+===================================+===================================+
|
||
| :link | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :visited | Because librsvg does not maintain |
|
||
| | browser history, this is parsed, |
|
||
| | but never matches |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :lang() | |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :not() | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :first-child | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :last-child | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :only-child | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :root | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :empty | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :nth-child() | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :nth-last-child() | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :nth-of-type() | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :nth-last-of-type() | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :first-of-type | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :last-of-type | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
| :only-of-type | [1]_ |
|
||
+-----------------------------------+-----------------------------------+
|
||
|
||
FIXME: which selectors, combinators, at-rules.
|
||
|
||
XML features
|
||
------------
|
||
|
||
XInclude
|
||
~~~~~~~~
|
||
|
||
Librsvg supports the following subset of `XML Inclusions (XInclude) <https://www.w3.org/TR/xinclude-11/>`_.
|
||
|
||
A document or element may declare the namespace for
|
||
``http://www.w3.org/2001/XInclude``, conventionally as an attribute
|
||
``xmlns:xi="http://www.w3.org/2001/XInclude"``.
|
||
|
||
The following discussion assumes an ``xi:`` shorthand; your namespace
|
||
declaration may use a different one, but ``xi:`` is conventional for
|
||
XInclude.
|
||
|
||
The following are examples of valid inclusions:
|
||
|
||
.. code-block:: xml
|
||
|
||
<xi:include href="foo.xml" parse="xml"/>
|
||
<!-- If foo.xml cannot be read, parsing stops with an error -->
|
||
|
||
<xi:include href="foo.xml" parse="xml">
|
||
<xi:fallback>
|
||
<some_fallback_element/>
|
||
<another_fallback_element/>
|
||
</xi:fallback>
|
||
</xi:include>
|
||
<!-- If foo.xml cannot be read, the elements inside xi:fallback are used instead.
|
||
If foo.xml has a syntax error, parsing stops with an error. -->
|
||
|
||
<xi:include href="foo.txt" parse="text" encoding="utf-8">
|
||
<xi:fallback>
|
||
Text to be included if foo.txt cannot be read.
|
||
</xi:fallback>
|
||
</xi:include>
|
||
|
||
For the ``xi:include`` element, the ``href`` attribute is mandatory,
|
||
and ``parse`` and ``encoding`` are optional:
|
||
|
||
* ``href`` - mandatory for librsvg. This is **different from the
|
||
XInclude specification**: the attribute is mandatory in librsvg,
|
||
while the spec assumes that if it is not present, then an
|
||
``xpointer`` or ``fragid`` attributes are used instead. Librsvg
|
||
does not support those. If there is no ``href`` attribute, librsvg
|
||
will ignore the whole ``xi:include`` element.
|
||
|
||
* ``parse`` - optional; supported values are ``xml`` and ``text``; the
|
||
default is ``xml``.
|
||
|
||
* ``encoding`` - optional; only used for including text files with
|
||
``parse="text"``. The value should be a `WHATWG label for an
|
||
encoding <https://encoding.spec.whatwg.org/#concept-encoding-get>`_,
|
||
for example, ``utf-8`` or ``koi8-r``.
|
||
|
||
Inside ``<xi:include>``, there can be an ``<xi:fallback>`` element to
|
||
specify what should be included if the ``href`` cannot be read.
|
||
|
||
``xml:lang`` and ``xml:space``
|
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
||
Individual elements can specify an `xml:lang attribute
|
||
<https://www.w3.org/TR/xml/#sec-lang-tag>`_ to specify their language.
|
||
This can be used in a ``<text>`` element for the main language of its
|
||
content, or generally for the purposes of CSS selector matching. Note
|
||
that this is different from the use of ``systemLanguage`` in children
|
||
of the ``<switch>`` element, which is used to `render different
|
||
elements depending on the system's language
|
||
<https://www.w3.org/TR/SVG2/struct.html#SwitchElement>`_.
|
||
|
||
Librsvg supports the `xml:space attribute
|
||
<https://www.w3.org/TR/xml/#sec-white-space>`_ and its handling per
|
||
SVG1.1. Note that this has been superseded in SVG2 with CSS
|
||
whitespace handling; librsvg does not support this yet as of
|
||
2023/Feb/10.
|
||
|
||
Explicitly Unsupported features
|
||
-------------------------------
|
||
|
||
- ``flowRoot`` element and its children - Inkscape, SVG 1.2 only.
|
||
|
||
- ``glyph-orientation-horizontal`` property - SVG1.1 only, removed in
|
||
SVG2
|
||
|
||
- The pseudo-classes ``:is()`` and ``:where()`` are part of Selectors
|
||
Level 4, which is still a working draft.
|
||
|
||
Footnotes
|
||
---------
|
||
|
||
.. [1]
|
||
These structural pseudo-classes are implemented in rust-selectors,
|
||
which librsvg uses.
|