| 1 |
Supported SVG and CSS features |
| 2 |
============================== |
| 3 |
|
| 4 |
Librsvg tries to be a mostly complete renderer for `SVG1.1 |
| 5 |
<https://www.w3.org/TR/SVG11/>`_ and `SVG2 |
| 6 |
<https://www.w3.org/TR/SVG2/>`_. |
| 7 |
|
| 8 |
In terms of processing external references, librsvg is a bit more |
| 9 |
strict than SVG’s “static mode” and a bit more lenient than “secure |
| 10 |
static mode”. See "`Security and locations of referenced files |
| 11 |
<https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/class.Handle.html#security-and-locations-of-referenced-files>`_" |
| 12 |
in the reference documentation for details. |
| 13 |
|
| 14 |
Animation, interactivity, and scripting are not supported. |
| 15 |
|
| 16 |
The SVG1.2 specification never made it past draft status in the W3C’s |
| 17 |
process, and librsvg does not support it. Note that SVG2 removed some of |
| 18 |
the features proposed for SVG1.2. |
| 19 |
|
| 20 |
Generally, librsvg tries to keep up with features in the SVG2 Candidate |
| 21 |
Recommendation spec. It ignores features in the SVG2 drafts that are not |
| 22 |
finalized yet. |
| 23 |
|
| 24 |
Alternative versions of SVG (SVG Tiny, SVG Basic, :issue:`SVG Native |
| 25 |
<689>`) are not explicitly supported. Their features which are a subset |
| 26 |
of SVG1.1 or SVG2 are supported if they are equivalent to the ones |
| 27 |
listed below. |
| 28 |
|
| 29 |
SVG2 offloads many of its features to the family of CSS3 specifications. |
| 30 |
Librsvg does not try to support them exhaustively (there are too many |
| 31 |
features in CSS!). Instead, we try to prioritize new features based on |
| 32 |
the needs which people express in librsvg’s bug tracker. Do you want a |
| 33 |
feature? `File an |
| 34 |
issue <https://gitlab.gnome.org/GNOME/librsvg/-/issues>`__! |
| 35 |
|
| 36 |
Supported raster image formats |
| 37 |
------------------------------ |
| 38 |
|
| 39 |
The ``image`` and ``feImage`` elements allow including an external |
| 40 |
file as raster data. Librsvg supports loading JPEG, PNG, GIF, and |
| 41 |
WEBP. Librsvg can optionally be compiled with support for AVIF, too; |
| 42 |
see the "Compile-time options" section in :doc:`compiling` for details. |
| 43 |
|
| 44 |
Attributes supported by all elements |
| 45 |
------------------------------------ |
| 46 |
|
| 47 |
+-----------------------------------+-----------------------------------+ |
| 48 |
| Attribute | Notes | |
| 49 |
+===================================+===================================+ |
| 50 |
| class | | |
| 51 |
+-----------------------------------+-----------------------------------+ |
| 52 |
| id | | |
| 53 |
+-----------------------------------+-----------------------------------+ |
| 54 |
| requiredExtensions | Used in children of the | |
| 55 |
| | ``switch`` element. | |
| 56 |
+-----------------------------------+-----------------------------------+ |
| 57 |
| requiredFeatures | Used in children of the | |
| 58 |
| | ``switch`` element. | |
| 59 |
+-----------------------------------+-----------------------------------+ |
| 60 |
| systemLanguage | Used in children of the | |
| 61 |
| | ``switch`` element. | |
| 62 |
+-----------------------------------+-----------------------------------+ |
| 63 |
| style | | |
| 64 |
+-----------------------------------+-----------------------------------+ |
| 65 |
| transform | The ``transform`` attribute has a | |
| 66 |
| | different syntax than the CSS | |
| 67 |
| | ``transform`` property. | |
| 68 |
+-----------------------------------+-----------------------------------+ |
| 69 |
| xml:lang | | |
| 70 |
+-----------------------------------+-----------------------------------+ |
| 71 |
| xml:space | | |
| 72 |
+-----------------------------------+-----------------------------------+ |
| 73 |
|
| 74 |
.. _elements: |
| 75 |
|
| 76 |
Elements and their specific attributes |
| 77 |
-------------------------------------- |
| 78 |
|
| 79 |
+-----------------------+-----------------------+-------------------------------+ |
| 80 |
| Element | Attributes | Notes | |
| 81 |
+=======================+=======================+===============================+ |
| 82 |
| a | | | |
| 83 |
+-----------------------+-----------------------+-------------------------------+ |
| 84 |
| | xlink:href | Needs xlink namespace | |
| 85 |
+-----------------------+-----------------------+-------------------------------+ |
| 86 |
| | href | SVG2 | |
| 87 |
+-----------------------+-----------------------+-------------------------------+ |
| 88 |
| circle | | | |
| 89 |
+-----------------------+-----------------------+-------------------------------+ |
| 90 |
| | cx | | |
| 91 |
+-----------------------+-----------------------+-------------------------------+ |
| 92 |
| | cy | | |
| 93 |
+-----------------------+-----------------------+-------------------------------+ |
| 94 |
| | r | | |
| 95 |
+-----------------------+-----------------------+-------------------------------+ |
| 96 |
| clipPath | | | |
| 97 |
+-----------------------+-----------------------+-------------------------------+ |
| 98 |
| | clipPathUnits | | |
| 99 |
+-----------------------+-----------------------+-------------------------------+ |
| 100 |
| defs | | | |
| 101 |
+-----------------------+-----------------------+-------------------------------+ |
| 102 |
| ellipse | | | |
| 103 |
+-----------------------+-----------------------+-------------------------------+ |
| 104 |
| | cx | | |
| 105 |
+-----------------------+-----------------------+-------------------------------+ |
| 106 |
| | cy | | |
| 107 |
+-----------------------+-----------------------+-------------------------------+ |
| 108 |
| | rx | | |
| 109 |
+-----------------------+-----------------------+-------------------------------+ |
| 110 |
| | ry | | |
| 111 |
+-----------------------+-----------------------+-------------------------------+ |
| 112 |
| feBlend | | See :ref:`filter_effects` | |
| 113 |
+-----------------------+-----------------------+-------------------------------+ |
| 114 |
| | in | | |
| 115 |
+-----------------------+-----------------------+-------------------------------+ |
| 116 |
| | in2 | | |
| 117 |
+-----------------------+-----------------------+-------------------------------+ |
| 118 |
| | mode | | |
| 119 |
+-----------------------+-----------------------+-------------------------------+ |
| 120 |
| feColorMatrix | | See :ref:`filter_effects` | |
| 121 |
+-----------------------+-----------------------+-------------------------------+ |
| 122 |
| | in | | |
| 123 |
+-----------------------+-----------------------+-------------------------------+ |
| 124 |
| | type | | |
| 125 |
+-----------------------+-----------------------+-------------------------------+ |
| 126 |
| | values | | |
| 127 |
+-----------------------+-----------------------+-------------------------------+ |
| 128 |
| feComponentTransfer | | See :ref:`filter_effects` | |
| 129 |
+-----------------------+-----------------------+-------------------------------+ |
| 130 |
| | in | | |
| 131 |
+-----------------------+-----------------------+-------------------------------+ |
| 132 |
| feComposite | | See :ref:`filter_effects` | |
| 133 |
+-----------------------+-----------------------+-------------------------------+ |
| 134 |
| | in | | |
| 135 |
+-----------------------+-----------------------+-------------------------------+ |
| 136 |
| | in2 | | |
| 137 |
+-----------------------+-----------------------+-------------------------------+ |
| 138 |
| | operator | | |
| 139 |
+-----------------------+-----------------------+-------------------------------+ |
| 140 |
| | k1 | | |
| 141 |
+-----------------------+-----------------------+-------------------------------+ |
| 142 |
| | k2 | | |
| 143 |
+-----------------------+-----------------------+-------------------------------+ |
| 144 |
| | k3 | | |
| 145 |
+-----------------------+-----------------------+-------------------------------+ |
| 146 |
| | k4 | | |
| 147 |
+-----------------------+-----------------------+-------------------------------+ |
| 148 |
| feConvolveMatrix | | See :ref:`filter_effects` | |
| 149 |
+-----------------------+-----------------------+-------------------------------+ |
| 150 |
| | in | | |
| 151 |
+-----------------------+-----------------------+-------------------------------+ |
| 152 |
| | order | | |
| 153 |
+-----------------------+-----------------------+-------------------------------+ |
| 154 |
| | divisor | | |
| 155 |
+-----------------------+-----------------------+-------------------------------+ |
| 156 |
| | bias | | |
| 157 |
+-----------------------+-----------------------+-------------------------------+ |
| 158 |
| | targetX | | |
| 159 |
+-----------------------+-----------------------+-------------------------------+ |
| 160 |
| | targetY | | |
| 161 |
+-----------------------+-----------------------+-------------------------------+ |
| 162 |
| | edgeMode | | |
| 163 |
+-----------------------+-----------------------+-------------------------------+ |
| 164 |
| | kernelMatrix | | |
| 165 |
+-----------------------+-----------------------+-------------------------------+ |
| 166 |
| | kernelUnitLength | | |
| 167 |
+-----------------------+-----------------------+-------------------------------+ |
| 168 |
| | preserveAlpha | | |
| 169 |
+-----------------------+-----------------------+-------------------------------+ |
| 170 |
| feDiffuseLighting | | See :ref:`filter_effects` | |
| 171 |
+-----------------------+-----------------------+-------------------------------+ |
| 172 |
| | in | | |
| 173 |
+-----------------------+-----------------------+-------------------------------+ |
| 174 |
| | surfaceScale | | |
| 175 |
+-----------------------+-----------------------+-------------------------------+ |
| 176 |
| | kernelUnitLength | | |
| 177 |
+-----------------------+-----------------------+-------------------------------+ |
| 178 |
| | diffuseConstant | | |
| 179 |
+-----------------------+-----------------------+-------------------------------+ |
| 180 |
| feDisplacementMap | | See :ref:`filter_effects` | |
| 181 |
+-----------------------+-----------------------+-------------------------------+ |
| 182 |
| | in | | |
| 183 |
+-----------------------+-----------------------+-------------------------------+ |
| 184 |
| | in2 | | |
| 185 |
+-----------------------+-----------------------+-------------------------------+ |
| 186 |
| | scale | | |
| 187 |
+-----------------------+-----------------------+-------------------------------+ |
| 188 |
| | xChannelSelector | | |
| 189 |
+-----------------------+-----------------------+-------------------------------+ |
| 190 |
| | yChannelSelector | | |
| 191 |
+-----------------------+-----------------------+-------------------------------+ |
| 192 |
| feDistantLight | | | |
| 193 |
+-----------------------+-----------------------+-------------------------------+ |
| 194 |
| | azimuth | | |
| 195 |
+-----------------------+-----------------------+-------------------------------+ |
| 196 |
| | elevation | | |
| 197 |
+-----------------------+-----------------------+-------------------------------+ |
| 198 |
| feDropShadow | | See :ref:`filter_effects` | |
| 199 |
| | | | |
| 200 |
| | | Also takes the | |
| 201 |
| | | flood-color and | |
| 202 |
| | | flood-opacity | |
| 203 |
| | | properties. | |
| 204 |
+-----------------------+-----------------------+-------------------------------+ |
| 205 |
| | in | | |
| 206 |
+-----------------------+-----------------------+-------------------------------+ |
| 207 |
| | dx | | |
| 208 |
+-----------------------+-----------------------+-------------------------------+ |
| 209 |
| | dy | | |
| 210 |
+-----------------------+-----------------------+-------------------------------+ |
| 211 |
| | stdDeviation | | |
| 212 |
+-----------------------+-----------------------+-------------------------------+ |
| 213 |
| feFuncA | | See | |
| 214 |
| | | :ref:`feComponentTransfer` | |
| 215 |
+-----------------------+-----------------------+-------------------------------+ |
| 216 |
| feFuncB | | See | |
| 217 |
| | | :ref:`feComponentTransfer` | |
| 218 |
+-----------------------+-----------------------+-------------------------------+ |
| 219 |
| feFuncG | | See | |
| 220 |
| | | :ref:`feComponentTransfer` | |
| 221 |
+-----------------------+-----------------------+-------------------------------+ |
| 222 |
| feFuncR | | See | |
| 223 |
| | | :ref:`feComponentTransfer` | |
| 224 |
+-----------------------+-----------------------+-------------------------------+ |
| 225 |
| feFlood | | See :ref:`filter_effects` | |
| 226 |
+-----------------------+-----------------------+-------------------------------+ |
| 227 |
| | | Parameters come from | |
| 228 |
| | | the flood-color and | |
| 229 |
| | | flood-opacity | |
| 230 |
| | | properties. | |
| 231 |
+-----------------------+-----------------------+-------------------------------+ |
| 232 |
| feGaussianBlur | | See :ref:`filter_effects` | |
| 233 |
+-----------------------+-----------------------+-------------------------------+ |
| 234 |
| | in | | |
| 235 |
+-----------------------+-----------------------+-------------------------------+ |
| 236 |
| | stdDeviation | | |
| 237 |
+-----------------------+-----------------------+-------------------------------+ |
| 238 |
| feImage | | See :ref:`filter_effects` | |
| 239 |
+-----------------------+-----------------------+-------------------------------+ |
| 240 |
| | xlink:href | Needs xlink namespace | |
| 241 |
+-----------------------+-----------------------+-------------------------------+ |
| 242 |
| | href | SVG2 | |
| 243 |
+-----------------------+-----------------------+-------------------------------+ |
| 244 |
| | path | Non-standard; used by | |
| 245 |
| | | old Adobe Illustrator | |
| 246 |
| | | versions. | |
| 247 |
+-----------------------+-----------------------+-------------------------------+ |
| 248 |
| | preserveAspectRatio | | |
| 249 |
+-----------------------+-----------------------+-------------------------------+ |
| 250 |
| feMerge | | See :ref:`filter_effects` | |
| 251 |
+-----------------------+-----------------------+-------------------------------+ |
| 252 |
| feMergeNode | | | |
| 253 |
+-----------------------+-----------------------+-------------------------------+ |
| 254 |
| | in | | |
| 255 |
+-----------------------+-----------------------+-------------------------------+ |
| 256 |
| feMorphology | | See :ref:`filter_effects` | |
| 257 |
+-----------------------+-----------------------+-------------------------------+ |
| 258 |
| | in | | |
| 259 |
+-----------------------+-----------------------+-------------------------------+ |
| 260 |
| | operator | | |
| 261 |
+-----------------------+-----------------------+-------------------------------+ |
| 262 |
| | radius | | |
| 263 |
+-----------------------+-----------------------+-------------------------------+ |
| 264 |
| feOffset | | See :ref:`filter_effects` | |
| 265 |
+-----------------------+-----------------------+-------------------------------+ |
| 266 |
| | in | | |
| 267 |
+-----------------------+-----------------------+-------------------------------+ |
| 268 |
| | dx | | |
| 269 |
+-----------------------+-----------------------+-------------------------------+ |
| 270 |
| | dy | | |
| 271 |
+-----------------------+-----------------------+-------------------------------+ |
| 272 |
| fePointLight | | | |
| 273 |
+-----------------------+-----------------------+-------------------------------+ |
| 274 |
| | x | | |
| 275 |
+-----------------------+-----------------------+-------------------------------+ |
| 276 |
| | y | | |
| 277 |
+-----------------------+-----------------------+-------------------------------+ |
| 278 |
| | z | | |
| 279 |
+-----------------------+-----------------------+-------------------------------+ |
| 280 |
| feSpecularLighting | | See :ref:`filter_effects` | |
| 281 |
+-----------------------+-----------------------+-------------------------------+ |
| 282 |
| | in | | |
| 283 |
+-----------------------+-----------------------+-------------------------------+ |
| 284 |
| | surfaceScale | | |
| 285 |
+-----------------------+-----------------------+-------------------------------+ |
| 286 |
| | kernelUnitLength | | |
| 287 |
+-----------------------+-----------------------+-------------------------------+ |
| 288 |
| | specularConstant | | |
| 289 |
+-----------------------+-----------------------+-------------------------------+ |
| 290 |
| | specularExponent | | |
| 291 |
+-----------------------+-----------------------+-------------------------------+ |
| 292 |
| feSpotLight | | | |
| 293 |
+-----------------------+-----------------------+-------------------------------+ |
| 294 |
| | x | | |
| 295 |
+-----------------------+-----------------------+-------------------------------+ |
| 296 |
| | y | | |
| 297 |
+-----------------------+-----------------------+-------------------------------+ |
| 298 |
| | z | | |
| 299 |
+-----------------------+-----------------------+-------------------------------+ |
| 300 |
| | pointsAtX | | |
| 301 |
+-----------------------+-----------------------+-------------------------------+ |
| 302 |
| | pointsAtY | | |
| 303 |
+-----------------------+-----------------------+-------------------------------+ |
| 304 |
| | pointsAtZ | | |
| 305 |
+-----------------------+-----------------------+-------------------------------+ |
| 306 |
| | specularExponent | | |
| 307 |
+-----------------------+-----------------------+-------------------------------+ |
| 308 |
| | limitingConeAngle | | |
| 309 |
+-----------------------+-----------------------+-------------------------------+ |
| 310 |
| feTile | | See :ref:`filter_effects` | |
| 311 |
+-----------------------+-----------------------+-------------------------------+ |
| 312 |
| | in | | |
| 313 |
+-----------------------+-----------------------+-------------------------------+ |
| 314 |
| feTurbulence | | See :ref:`filter_effects` | |
| 315 |
+-----------------------+-----------------------+-------------------------------+ |
| 316 |
| | baseFrequency | | |
| 317 |
+-----------------------+-----------------------+-------------------------------+ |
| 318 |
| | numOctaves | | |
| 319 |
+-----------------------+-----------------------+-------------------------------+ |
| 320 |
| | seed | | |
| 321 |
+-----------------------+-----------------------+-------------------------------+ |
| 322 |
| | stitchTiles | | |
| 323 |
+-----------------------+-----------------------+-------------------------------+ |
| 324 |
| | type | | |
| 325 |
+-----------------------+-----------------------+-------------------------------+ |
| 326 |
| filter | | | |
| 327 |
+-----------------------+-----------------------+-------------------------------+ |
| 328 |
| | filterUnits | | |
| 329 |
+-----------------------+-----------------------+-------------------------------+ |
| 330 |
| | primitiveUnits | | |
| 331 |
+-----------------------+-----------------------+-------------------------------+ |
| 332 |
| | x | | |
| 333 |
+-----------------------+-----------------------+-------------------------------+ |
| 334 |
| | y | | |
| 335 |
+-----------------------+-----------------------+-------------------------------+ |
| 336 |
| | width | | |
| 337 |
+-----------------------+-----------------------+-------------------------------+ |
| 338 |
| | height | | |
| 339 |
+-----------------------+-----------------------+-------------------------------+ |
| 340 |
| g | | | |
| 341 |
+-----------------------+-----------------------+-------------------------------+ |
| 342 |
| image | | | |
| 343 |
+-----------------------+-----------------------+-------------------------------+ |
| 344 |
| | xlink:href | Needs xlink namespace | |
| 345 |
+-----------------------+-----------------------+-------------------------------+ |
| 346 |
| | href | SVG2 | |
| 347 |
+-----------------------+-----------------------+-------------------------------+ |
| 348 |
| | path | Non-standard; used by | |
| 349 |
| | | old Adobe Illustrator | |
| 350 |
| | | versions. | |
| 351 |
+-----------------------+-----------------------+-------------------------------+ |
| 352 |
| | x | | |
| 353 |
+-----------------------+-----------------------+-------------------------------+ |
| 354 |
| | y | | |
| 355 |
+-----------------------+-----------------------+-------------------------------+ |
| 356 |
| | width | | |
| 357 |
+-----------------------+-----------------------+-------------------------------+ |
| 358 |
| | height | | |
| 359 |
+-----------------------+-----------------------+-------------------------------+ |
| 360 |
| | preserveAspectRatio | | |
| 361 |
+-----------------------+-----------------------+-------------------------------+ |
| 362 |
| line | | | |
| 363 |
+-----------------------+-----------------------+-------------------------------+ |
| 364 |
| | x1 | | |
| 365 |
+-----------------------+-----------------------+-------------------------------+ |
| 366 |
| | y1 | | |
| 367 |
+-----------------------+-----------------------+-------------------------------+ |
| 368 |
| | x2 | | |
| 369 |
+-----------------------+-----------------------+-------------------------------+ |
| 370 |
| | y2 | | |
| 371 |
+-----------------------+-----------------------+-------------------------------+ |
| 372 |
| linearGradient | | | |
| 373 |
+-----------------------+-----------------------+-------------------------------+ |
| 374 |
| | gradientUnits | | |
| 375 |
+-----------------------+-----------------------+-------------------------------+ |
| 376 |
| | gradientTransform | | |
| 377 |
+-----------------------+-----------------------+-------------------------------+ |
| 378 |
| | spreadMethod | | |
| 379 |
+-----------------------+-----------------------+-------------------------------+ |
| 380 |
| | x1 | | |
| 381 |
+-----------------------+-----------------------+-------------------------------+ |
| 382 |
| | y1 | | |
| 383 |
+-----------------------+-----------------------+-------------------------------+ |
| 384 |
| | x2 | | |
| 385 |
+-----------------------+-----------------------+-------------------------------+ |
| 386 |
| | y2 | | |
| 387 |
+-----------------------+-----------------------+-------------------------------+ |
| 388 |
| marker | | | |
| 389 |
+-----------------------+-----------------------+-------------------------------+ |
| 390 |
| | markerUnits | | |
| 391 |
+-----------------------+-----------------------+-------------------------------+ |
| 392 |
| | refX | | |
| 393 |
+-----------------------+-----------------------+-------------------------------+ |
| 394 |
| | refY | | |
| 395 |
+-----------------------+-----------------------+-------------------------------+ |
| 396 |
| | markerWidth | | |
| 397 |
+-----------------------+-----------------------+-------------------------------+ |
| 398 |
| | markerHeight | | |
| 399 |
+-----------------------+-----------------------+-------------------------------+ |
| 400 |
| | orient | | |
| 401 |
+-----------------------+-----------------------+-------------------------------+ |
| 402 |
| | preserveAspectRatio | | |
| 403 |
+-----------------------+-----------------------+-------------------------------+ |
| 404 |
| | viewBox | | |
| 405 |
+-----------------------+-----------------------+-------------------------------+ |
| 406 |
| mask | | | |
| 407 |
+-----------------------+-----------------------+-------------------------------+ |
| 408 |
| | x | | |
| 409 |
+-----------------------+-----------------------+-------------------------------+ |
| 410 |
| | y | | |
| 411 |
+-----------------------+-----------------------+-------------------------------+ |
| 412 |
| | width | | |
| 413 |
+-----------------------+-----------------------+-------------------------------+ |
| 414 |
| | height | | |
| 415 |
+-----------------------+-----------------------+-------------------------------+ |
| 416 |
| | maskUnits | | |
| 417 |
+-----------------------+-----------------------+-------------------------------+ |
| 418 |
| | maskContentUnits | | |
| 419 |
+-----------------------+-----------------------+-------------------------------+ |
| 420 |
| path | | | |
| 421 |
+-----------------------+-----------------------+-------------------------------+ |
| 422 |
| | d | | |
| 423 |
+-----------------------+-----------------------+-------------------------------+ |
| 424 |
| pattern | | | |
| 425 |
+-----------------------+-----------------------+-------------------------------+ |
| 426 |
| | xlink:href | Needs xlink namespace | |
| 427 |
+-----------------------+-----------------------+-------------------------------+ |
| 428 |
| | href | SVG2 | |
| 429 |
+-----------------------+-----------------------+-------------------------------+ |
| 430 |
| | patternUnits | | |
| 431 |
+-----------------------+-----------------------+-------------------------------+ |
| 432 |
| | patternContentUnits | | |
| 433 |
+-----------------------+-----------------------+-------------------------------+ |
| 434 |
| | patternTransform | | |
| 435 |
+-----------------------+-----------------------+-------------------------------+ |
| 436 |
| | preserveAspectRatio | | |
| 437 |
+-----------------------+-----------------------+-------------------------------+ |
| 438 |
| | viewBox | | |
| 439 |
+-----------------------+-----------------------+-------------------------------+ |
| 440 |
| | x | | |
| 441 |
+-----------------------+-----------------------+-------------------------------+ |
| 442 |
| | y | | |
| 443 |
+-----------------------+-----------------------+-------------------------------+ |
| 444 |
| | width | | |
| 445 |
+-----------------------+-----------------------+-------------------------------+ |
| 446 |
| | height | | |
| 447 |
+-----------------------+-----------------------+-------------------------------+ |
| 448 |
| polygon | | | |
| 449 |
+-----------------------+-----------------------+-------------------------------+ |
| 450 |
| | points | | |
| 451 |
+-----------------------+-----------------------+-------------------------------+ |
| 452 |
| polyline | | | |
| 453 |
+-----------------------+-----------------------+-------------------------------+ |
| 454 |
| | points | | |
| 455 |
+-----------------------+-----------------------+-------------------------------+ |
| 456 |
| radialGradient | | | |
| 457 |
+-----------------------+-----------------------+-------------------------------+ |
| 458 |
| | gradientUnits | | |
| 459 |
+-----------------------+-----------------------+-------------------------------+ |
| 460 |
| | gradientTransform | | |
| 461 |
+-----------------------+-----------------------+-------------------------------+ |
| 462 |
| | spreadMethod | | |
| 463 |
+-----------------------+-----------------------+-------------------------------+ |
| 464 |
| | cx | | |
| 465 |
+-----------------------+-----------------------+-------------------------------+ |
| 466 |
| | cy | | |
| 467 |
+-----------------------+-----------------------+-------------------------------+ |
| 468 |
| | r | | |
| 469 |
+-----------------------+-----------------------+-------------------------------+ |
| 470 |
| | fx | | |
| 471 |
+-----------------------+-----------------------+-------------------------------+ |
| 472 |
| | fx | | |
| 473 |
+-----------------------+-----------------------+-------------------------------+ |
| 474 |
| | fr | | |
| 475 |
+-----------------------+-----------------------+-------------------------------+ |
| 476 |
| rect | | | |
| 477 |
+-----------------------+-----------------------+-------------------------------+ |
| 478 |
| | x | | |
| 479 |
+-----------------------+-----------------------+-------------------------------+ |
| 480 |
| | y | | |
| 481 |
+-----------------------+-----------------------+-------------------------------+ |
| 482 |
| | width | | |
| 483 |
+-----------------------+-----------------------+-------------------------------+ |
| 484 |
| | height | | |
| 485 |
+-----------------------+-----------------------+-------------------------------+ |
| 486 |
| | rx | | |
| 487 |
+-----------------------+-----------------------+-------------------------------+ |
| 488 |
| | ry | | |
| 489 |
+-----------------------+-----------------------+-------------------------------+ |
| 490 |
| stop | | | |
| 491 |
+-----------------------+-----------------------+-------------------------------+ |
| 492 |
| | offset | | |
| 493 |
+-----------------------+-----------------------+-------------------------------+ |
| 494 |
| style | | | |
| 495 |
+-----------------------+-----------------------+-------------------------------+ |
| 496 |
| | type | | |
| 497 |
+-----------------------+-----------------------+-------------------------------+ |
| 498 |
| svg | | | |
| 499 |
+-----------------------+-----------------------+-------------------------------+ |
| 500 |
| | x | | |
| 501 |
+-----------------------+-----------------------+-------------------------------+ |
| 502 |
| | y | | |
| 503 |
+-----------------------+-----------------------+-------------------------------+ |
| 504 |
| | width | | |
| 505 |
+-----------------------+-----------------------+-------------------------------+ |
| 506 |
| | height | | |
| 507 |
+-----------------------+-----------------------+-------------------------------+ |
| 508 |
| | viewBox | | |
| 509 |
+-----------------------+-----------------------+-------------------------------+ |
| 510 |
| | preserveAspectRatio | | |
| 511 |
+-----------------------+-----------------------+-------------------------------+ |
| 512 |
| switch | | | |
| 513 |
+-----------------------+-----------------------+-------------------------------+ |
| 514 |
| symbol | | | |
| 515 |
+-----------------------+-----------------------+-------------------------------+ |
| 516 |
| | preserveAspectRatio | | |
| 517 |
+-----------------------+-----------------------+-------------------------------+ |
| 518 |
| | viewBox | | |
| 519 |
+-----------------------+-----------------------+-------------------------------+ |
| 520 |
| text | | | |
| 521 |
+-----------------------+-----------------------+-------------------------------+ |
| 522 |
| | x | | |
| 523 |
+-----------------------+-----------------------+-------------------------------+ |
| 524 |
| | y | | |
| 525 |
+-----------------------+-----------------------+-------------------------------+ |
| 526 |
| | dx | | |
| 527 |
+-----------------------+-----------------------+-------------------------------+ |
| 528 |
| | dy | | |
| 529 |
+-----------------------+-----------------------+-------------------------------+ |
| 530 |
| tref | | | |
| 531 |
+-----------------------+-----------------------+-------------------------------+ |
| 532 |
| | xlink:href | Needs xlink namespace | |
| 533 |
+-----------------------+-----------------------+-------------------------------+ |
| 534 |
| tspan | | | |
| 535 |
+-----------------------+-----------------------+-------------------------------+ |
| 536 |
| | x | | |
| 537 |
+-----------------------+-----------------------+-------------------------------+ |
| 538 |
| | y | | |
| 539 |
+-----------------------+-----------------------+-------------------------------+ |
| 540 |
| | dx | | |
| 541 |
+-----------------------+-----------------------+-------------------------------+ |
| 542 |
| | dy | | |
| 543 |
+-----------------------+-----------------------+-------------------------------+ |
| 544 |
| use | | | |
| 545 |
+-----------------------+-----------------------+-------------------------------+ |
| 546 |
| | xlink:href | Needs xlink namespace | |
| 547 |
+-----------------------+-----------------------+-------------------------------+ |
| 548 |
| | href | SVG2 | |
| 549 |
+-----------------------+-----------------------+-------------------------------+ |
| 550 |
| | x | | |
| 551 |
+-----------------------+-----------------------+-------------------------------+ |
| 552 |
| | y | | |
| 553 |
+-----------------------+-----------------------+-------------------------------+ |
| 554 |
| | width | | |
| 555 |
+-----------------------+-----------------------+-------------------------------+ |
| 556 |
| | height | | |
| 557 |
+-----------------------+-----------------------+-------------------------------+ |
| 558 |
|
| 559 |
CSS properties |
| 560 |
-------------- |
| 561 |
|
| 562 |
The following are shorthand properties. They are not available as |
| 563 |
presentation attributes, only as style properties, so for example you |
| 564 |
have to use ``<path style="marker: url(#foo);"/>``, since there is no |
| 565 |
``marker`` attribute. |
| 566 |
|
| 567 |
+----------------------------+--------------------------------------------------------------------+ |
| 568 |
| Property | Notes | |
| 569 |
+============================+====================================================================+ |
| 570 |
| font | | |
| 571 |
+----------------------------+--------------------------------------------------------------------+ |
| 572 |
| glyph-orientation-vertical | Supports only CSS Writing Modes 3 values: auto, 0, 90, 0deg, 90deg | |
| 573 |
+----------------------------+--------------------------------------------------------------------+ |
| 574 |
| marker | | |
| 575 |
+----------------------------+--------------------------------------------------------------------+ |
| 576 |
|
| 577 |
The following are longhand properties. Most of them are available as |
| 578 |
presentation attributes, e.g. you can use ``<rect fill="blue"/>`` as |
| 579 |
well as ``<rect style="fill: blue;"/>``. The Notes column indicates |
| 580 |
which properties are not available as presentation attributes. |
| 581 |
|
| 582 |
+-----------------------+----------------------------------------------+ |
| 583 |
| Property | Notes | |
| 584 |
+=======================+==============================================+ |
| 585 |
| baseline-shift | | |
| 586 |
+-----------------------+----------------------------------------------+ |
| 587 |
| clip-path | | |
| 588 |
+-----------------------+----------------------------------------------+ |
| 589 |
| clip-rule | | |
| 590 |
+-----------------------+----------------------------------------------+ |
| 591 |
| color | | |
| 592 |
+-----------------------+----------------------------------------------+ |
| 593 |
| color- | | |
| 594 |
| interpolation-filters | | |
| 595 |
+-----------------------+----------------------------------------------+ |
| 596 |
| direction | | |
| 597 |
+-----------------------+----------------------------------------------+ |
| 598 |
| display | | |
| 599 |
+-----------------------+----------------------------------------------+ |
| 600 |
| enable-background | | |
| 601 |
+-----------------------+----------------------------------------------+ |
| 602 |
| fill | | |
| 603 |
+-----------------------+----------------------------------------------+ |
| 604 |
| fill-opacity | | |
| 605 |
+-----------------------+----------------------------------------------+ |
| 606 |
| fill-rule | | |
| 607 |
+-----------------------+----------------------------------------------+ |
| 608 |
| filter | | |
| 609 |
+-----------------------+----------------------------------------------+ |
| 610 |
| flood-color | | |
| 611 |
+-----------------------+----------------------------------------------+ |
| 612 |
| flood-opacity | | |
| 613 |
+-----------------------+----------------------------------------------+ |
| 614 |
| font-family | | |
| 615 |
+-----------------------+----------------------------------------------+ |
| 616 |
| font-size | | |
| 617 |
+-----------------------+----------------------------------------------+ |
| 618 |
| font-stretch | | |
| 619 |
+-----------------------+----------------------------------------------+ |
| 620 |
| font-style | | |
| 621 |
+-----------------------+----------------------------------------------+ |
| 622 |
| font-variant | | |
| 623 |
+-----------------------+----------------------------------------------+ |
| 624 |
| font-weight | | |
| 625 |
+-----------------------+----------------------------------------------+ |
| 626 |
| image-rendering | | |
| 627 |
+-----------------------+----------------------------------------------+ |
| 628 |
| isolation | Not available as a presentation attribute. | |
| 629 |
+-----------------------+----------------------------------------------+ |
| 630 |
| letter-spacing | | |
| 631 |
+-----------------------+----------------------------------------------+ |
| 632 |
| lighting-color | | |
| 633 |
+-----------------------+----------------------------------------------+ |
| 634 |
| line-height | Not available as a presentation attribute. | |
| 635 |
+-----------------------+----------------------------------------------+ |
| 636 |
| marker-end | | |
| 637 |
+-----------------------+----------------------------------------------+ |
| 638 |
| marker-mid | | |
| 639 |
+-----------------------+----------------------------------------------+ |
| 640 |
| marker-start | | |
| 641 |
+-----------------------+----------------------------------------------+ |
| 642 |
| mask | | |
| 643 |
+-----------------------+----------------------------------------------+ |
| 644 |
| mask-type | | |
| 645 |
+-----------------------+----------------------------------------------+ |
| 646 |
| mix-blend-mode | Not available as a presentation attribute. | |
| 647 |
+-----------------------+----------------------------------------------+ |
| 648 |
| opacity | | |
| 649 |
+-----------------------+----------------------------------------------+ |
| 650 |
| overflow | | |
| 651 |
+-----------------------+----------------------------------------------+ |
| 652 |
| paint-order | | |
| 653 |
+-----------------------+----------------------------------------------+ |
| 654 |
| shape-rendering | | |
| 655 |
+-----------------------+----------------------------------------------+ |
| 656 |
| stop-color | | |
| 657 |
+-----------------------+----------------------------------------------+ |
| 658 |
| stop-opacity | | |
| 659 |
+-----------------------+----------------------------------------------+ |
| 660 |
| stroke | | |
| 661 |
+-----------------------+----------------------------------------------+ |
| 662 |
| stroke-dasharray | | |
| 663 |
+-----------------------+----------------------------------------------+ |
| 664 |
| stroke-dashoffset | | |
| 665 |
+-----------------------+----------------------------------------------+ |
| 666 |
| stroke-linecap | | |
| 667 |
+-----------------------+----------------------------------------------+ |
| 668 |
| stroke-linejoin | | |
| 669 |
+-----------------------+----------------------------------------------+ |
| 670 |
| stroke-miterlimit | | |
| 671 |
+-----------------------+----------------------------------------------+ |
| 672 |
| stroke-opacity | | |
| 673 |
+-----------------------+----------------------------------------------+ |
| 674 |
| stroke-width | | |
| 675 |
+-----------------------+----------------------------------------------+ |
| 676 |
| text-anchor | | |
| 677 |
+-----------------------+----------------------------------------------+ |
| 678 |
| text-decoration | | |
| 679 |
+-----------------------+----------------------------------------------+ |
| 680 |
| text-orientation | Not available as a presentation attribute. | |
| 681 |
+-----------------------+----------------------------------------------+ |
| 682 |
| text-rendering | | |
| 683 |
+-----------------------+----------------------------------------------+ |
| 684 |
| transform | SVG2; different syntax from the | |
| 685 |
| | ``transform`` attribute. | |
| 686 |
+-----------------------+----------------------------------------------+ |
| 687 |
| unicode-bidi | | |
| 688 |
+-----------------------+----------------------------------------------+ |
| 689 |
| vector-effect | Only ``non-scaling-stroke`` is supported for | |
| 690 |
| | paths. | |
| 691 |
+-----------------------+----------------------------------------------+ |
| 692 |
| visibility | | |
| 693 |
+-----------------------+----------------------------------------------+ |
| 694 |
| white-space | Not available as a presentation attribute. | |
| 695 |
+-----------------------+----------------------------------------------+ |
| 696 |
| writing-mode | | |
| 697 |
+-----------------------+----------------------------------------------+ |
| 698 |
|
| 699 |
.. _filter_effects: |
| 700 |
|
| 701 |
Filter effects |
| 702 |
-------------- |
| 703 |
|
| 704 |
The following elements are filter effects: |
| 705 |
|
| 706 |
- feBlend |
| 707 |
- feColorMatrix |
| 708 |
- feComponentTransfer |
| 709 |
- feComposite |
| 710 |
- feConvolveMatrix |
| 711 |
- feDiffuseLighting |
| 712 |
- feDisplacementMap |
| 713 |
- feDropShadow |
| 714 |
- feFlood |
| 715 |
- feGaussianBlur |
| 716 |
- feImage |
| 717 |
- feMerge |
| 718 |
- feMorphology |
| 719 |
- feOffset |
| 720 |
- feSpecularLighting |
| 721 |
- feTile |
| 722 |
- feTurbulence |
| 723 |
|
| 724 |
All of those elements for filter effects support these attributes: |
| 725 |
|
| 726 |
+-----------------------------------+-----------------------------------+ |
| 727 |
| Attribute | Notes | |
| 728 |
+===================================+===================================+ |
| 729 |
| x | | |
| 730 |
+-----------------------------------+-----------------------------------+ |
| 731 |
| y | | |
| 732 |
+-----------------------------------+-----------------------------------+ |
| 733 |
| width | | |
| 734 |
+-----------------------------------+-----------------------------------+ |
| 735 |
| height | | |
| 736 |
+-----------------------------------+-----------------------------------+ |
| 737 |
| result | | |
| 738 |
+-----------------------------------+-----------------------------------+ |
| 739 |
|
| 740 |
Some filter effect elements take one input in the ``in`` attribute, and |
| 741 |
some others take two inputs in the ``in``, ``in2`` attributes. See the |
| 742 |
:ref:`table of elements <elements>` above for details. |
| 743 |
|
| 744 |
.. _feComponentTransfer: |
| 745 |
|
| 746 |
Filter effect feComponentTransfer |
| 747 |
--------------------------------- |
| 748 |
|
| 749 |
The ``feComponentTransfer`` element can contain children ``feFuncA``, |
| 750 |
``feFuncR``, ``feFuncG``, ``feFuncB``, and those all support these |
| 751 |
attributes: |
| 752 |
|
| 753 |
=========== ===== |
| 754 |
Attribute Notes |
| 755 |
=========== ===== |
| 756 |
type |
| 757 |
tableValues |
| 758 |
slope |
| 759 |
intercept |
| 760 |
amplitude |
| 761 |
exponent |
| 762 |
offset |
| 763 |
=========== ===== |
| 764 |
|
| 765 |
CSS features |
| 766 |
------------ |
| 767 |
|
| 768 |
Pseudo-classes |
| 769 |
~~~~~~~~~~~~~~ |
| 770 |
|
| 771 |
+-----------------------------------+-----------------------------------+ |
| 772 |
| Pseudo-class | Notes | |
| 773 |
+===================================+===================================+ |
| 774 |
| :link | | |
| 775 |
+-----------------------------------+-----------------------------------+ |
| 776 |
| :visited | Because librsvg does not maintain | |
| 777 |
| | browser history, this is parsed, | |
| 778 |
| | but never matches | |
| 779 |
+-----------------------------------+-----------------------------------+ |
| 780 |
| :lang() | | |
| 781 |
+-----------------------------------+-----------------------------------+ |
| 782 |
| :not() | [1]_ | |
| 783 |
+-----------------------------------+-----------------------------------+ |
| 784 |
| :first-child | [1]_ | |
| 785 |
+-----------------------------------+-----------------------------------+ |
| 786 |
| :last-child | [1]_ | |
| 787 |
+-----------------------------------+-----------------------------------+ |
| 788 |
| :only-child | [1]_ | |
| 789 |
+-----------------------------------+-----------------------------------+ |
| 790 |
| :root | [1]_ | |
| 791 |
+-----------------------------------+-----------------------------------+ |
| 792 |
| :empty | [1]_ | |
| 793 |
+-----------------------------------+-----------------------------------+ |
| 794 |
| :nth-child() | [1]_ | |
| 795 |
+-----------------------------------+-----------------------------------+ |
| 796 |
| :nth-last-child() | [1]_ | |
| 797 |
+-----------------------------------+-----------------------------------+ |
| 798 |
| :nth-of-type() | [1]_ | |
| 799 |
+-----------------------------------+-----------------------------------+ |
| 800 |
| :nth-last-of-type() | [1]_ | |
| 801 |
+-----------------------------------+-----------------------------------+ |
| 802 |
| :first-of-type | [1]_ | |
| 803 |
+-----------------------------------+-----------------------------------+ |
| 804 |
| :last-of-type | [1]_ | |
| 805 |
+-----------------------------------+-----------------------------------+ |
| 806 |
| :only-of-type | [1]_ | |
| 807 |
+-----------------------------------+-----------------------------------+ |
| 808 |
|
| 809 |
FIXME: which selectors, combinators, at-rules. |
| 810 |
|
| 811 |
XML features |
| 812 |
------------ |
| 813 |
|
| 814 |
XInclude |
| 815 |
~~~~~~~~ |
| 816 |
|
| 817 |
Librsvg supports the following subset of `XML Inclusions (XInclude) <https://www.w3.org/TR/xinclude-11/>`_. |
| 818 |
|
| 819 |
A document or element may declare the namespace for |
| 820 |
``http://www.w3.org/2001/XInclude``, conventionally as an attribute |
| 821 |
``xmlns:xi="http://www.w3.org/2001/XInclude"``. |
| 822 |
|
| 823 |
The following discussion assumes an ``xi:`` shorthand; your namespace |
| 824 |
declaration may use a different one, but ``xi:`` is conventional for |
| 825 |
XInclude. |
| 826 |
|
| 827 |
The following are examples of valid inclusions: |
| 828 |
|
| 829 |
.. code-block:: xml |
| 830 |
|
| 831 |
<xi:include href="foo.xml" parse="xml"/> |
| 832 |
<!-- If foo.xml cannot be read, parsing stops with an error --> |
| 833 |
|
| 834 |
<xi:include href="foo.xml" parse="xml"> |
| 835 |
<xi:fallback> |
| 836 |
<some_fallback_element/> |
| 837 |
<another_fallback_element/> |
| 838 |
</xi:fallback> |
| 839 |
</xi:include> |
| 840 |
<!-- If foo.xml cannot be read, the elements inside xi:fallback are used instead. |
| 841 |
If foo.xml has a syntax error, parsing stops with an error. --> |
| 842 |
|
| 843 |
<xi:include href="foo.txt" parse="text" encoding="utf-8"> |
| 844 |
<xi:fallback> |
| 845 |
Text to be included if foo.txt cannot be read. |
| 846 |
</xi:fallback> |
| 847 |
</xi:include> |
| 848 |
|
| 849 |
For the ``xi:include`` element, the ``href`` attribute is mandatory, |
| 850 |
and ``parse`` and ``encoding`` are optional: |
| 851 |
|
| 852 |
* ``href`` - mandatory for librsvg. This is **different from the |
| 853 |
XInclude specification**: the attribute is mandatory in librsvg, |
| 854 |
while the spec assumes that if it is not present, then an |
| 855 |
``xpointer`` or ``fragid`` attributes are used instead. Librsvg |
| 856 |
does not support those. If there is no ``href`` attribute, librsvg |
| 857 |
will ignore the whole ``xi:include`` element. |
| 858 |
|
| 859 |
* ``parse`` - optional; supported values are ``xml`` and ``text``; the |
| 860 |
default is ``xml``. |
| 861 |
|
| 862 |
* ``encoding`` - optional; only used for including text files with |
| 863 |
``parse="text"``. The value should be a `WHATWG label for an |
| 864 |
encoding <https://encoding.spec.whatwg.org/#concept-encoding-get>`_, |
| 865 |
for example, ``utf-8`` or ``koi8-r``. |
| 866 |
|
| 867 |
Inside ``<xi:include>``, there can be an ``<xi:fallback>`` element to |
| 868 |
specify what should be included if the ``href`` cannot be read. |
| 869 |
|
| 870 |
``xml:lang`` and ``xml:space`` |
| 871 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 872 |
|
| 873 |
Individual elements can specify an `xml:lang attribute |
| 874 |
<https://www.w3.org/TR/xml/#sec-lang-tag>`_ to specify their language. |
| 875 |
This can be used in a ``<text>`` element for the main language of its |
| 876 |
content, or generally for the purposes of CSS selector matching. Note |
| 877 |
that this is different from the use of ``systemLanguage`` in children |
| 878 |
of the ``<switch>`` element, which is used to `render different |
| 879 |
elements depending on the system's language |
| 880 |
<https://www.w3.org/TR/SVG2/struct.html#SwitchElement>`_. |
| 881 |
|
| 882 |
Librsvg supports the `xml:space attribute |
| 883 |
<https://www.w3.org/TR/xml/#sec-white-space>`_ and its handling per |
| 884 |
SVG1.1. Note that this has been superseded in SVG2 with CSS |
| 885 |
whitespace handling; librsvg does not support this yet as of |
| 886 |
2023/Feb/10. |
| 887 |
|
| 888 |
Explicitly Unsupported features |
| 889 |
------------------------------- |
| 890 |
|
| 891 |
- ``flowRoot`` element and its children - Inkscape, SVG 1.2 only. |
| 892 |
|
| 893 |
- ``glyph-orientation-horizontal`` property - SVG1.1 only, removed in |
| 894 |
SVG2 |
| 895 |
|
| 896 |
- The pseudo-classes ``:is()`` and ``:where()`` are part of Selectors |
| 897 |
Level 4, which is still a working draft. |
| 898 |
|
| 899 |
Footnotes |
| 900 |
--------- |
| 901 |
|
| 902 |
.. [1] |
| 903 |
These structural pseudo-classes are implemented in rust-selectors, |
| 904 |
which librsvg uses. |