summaryrefslogtreecommitdiff
path: root/FEATURES.md
blob: 9e9570ead215820bd72c1e486af963eae2e674aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# SVG and CSS features that librsvg supports

Table of contents:

[[_TOC_]]

Librsvg tries to be a mostly complete renderer for SVG1.1 and 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" 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, [SVG
Native](https://gitlab.gnome.org/GNOME/librsvg/-/issues/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)!

# 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 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 "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | in2                 |                                                                    |
|                     | mode                |                                                                    |
| feColorMatrix       |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | type                |                                                                    |
|                     | values              |                                                                    |
| feComponentTransfer |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
| feComposite         |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | in2                 |                                                                    |
|                     | operator            |                                                                    |
|                     | k1                  |                                                                    |
|                     | k2                  |                                                                    |
|                     | k3                  |                                                                    |
|                     | k4                  |                                                                    |
| feConvolveMatrix    |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | order               |                                                                    |
|                     | divisor             |                                                                    |
|                     | bias                |                                                                    |
|                     | targetX             |                                                                    |
|                     | targetY             |                                                                    |
|                     | edgeMode            |                                                                    |
|                     | kernelMatrix        |                                                                    |
|                     | kernelUnitLength    |                                                                    |
|                     | preserveAlpha       |                                                                    |
| feDiffuseLighting   |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | surfaceScale        |                                                                    |
|                     | kernelUnitLength    |                                                                    |
|                     | diffuseConstant     |                                                                    |
| feDisplacementMap   |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | in2                 |                                                                    |
|                     | scale               |                                                                    |
|                     | xChannelSelector    |                                                                    |
|                     | yChannelSelector    |                                                                    |
| feDistantLight      |                     |                                                                    |
|                     | azimuth             |                                                                    |
|                     | elevation           |                                                                    |
| feFuncA             |                     | See "Filter effect feComponentTransfer"                            |
| feFuncB             |                     | See "Filter effect feComponentTransfer"                            |
| feFuncG             |                     | See "Filter effect feComponentTransfer"                            |
| feFuncR             |                     | See "Filter effect feComponentTransfer"                            |
| feFlood             |                     | See "Filter effects"                                               |
|                     |                     | Parameters come from the flood-color and flood-opacity properties. |
| feGaussianBlur      |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | stdDeviation        |                                                                    |
| feImage             |                     | See "Filter effects"                                               |
|                     | xlink:href          | Needs xlink namespace                                              |
|                     | href                | SVG2                                                               |
|                     | path                | Non-standard; used by old Adobe Illustrator versions.              |
|                     | preserveAspectRatio |                                                                    |
| feMerge             |                     | See "Filter effects"                                               |
| feMergeNode         |                     |                                                                    |
|                     | in                  |                                                                    |
| feMorphology        |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | operator            |                                                                    |
|                     | radius              |                                                                    |
| feOffset            |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | dx                  |                                                                    |
|                     | dy                  |                                                                    |
| fePointLight        |                     |                                                                    |
|                     | x                   |                                                                    |
|                     | y                   |                                                                    |
|                     | z                   |                                                                    |
| feSpecularLighting  |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
|                     | surfaceScale        |                                                                    |
|                     | kernelUnitLength    |                                                                    |
|                     | specularConstant    |                                                                    |
|                     | specularExponent    |                                                                    |
| feSpotLight         |                     |                                                                    |
|                     | x                   |                                                                    |
|                     | y                   |                                                                    |
|                     | z                   |                                                                    |
|                     | pointsAtX           |                                                                    |
|                     | pointsAtY           |                                                                    |
|                     | pointsAtZ           |                                                                    |
|                     | specularExponent    |                                                                    |
|                     | limitingConeAngle   |                                                                    |
| feTile              |                     | See "Filter effects"                                               |
|                     | in                  |                                                                    |
| feTurbulence        |                     | See "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                 |                                                        |
| 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                  |                                                        |
| writing-mode                |                                                        |

## Filter effects

The following elements are filter effects:

* feBlend
* feColorMatrix
* feComponentTransfer
* feComposite
* feConvolveMatrix
* feDiffuseLighting
* feDisplacementMap
* 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
table of elements above for details.

## 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]                                                                                 |

[^1]: These structural pseudo-classes are implemented in rust-selectors, which librsvg uses.

FIXME: which selectors, combinators, at-rules.

# XML features

FIXME: `<xi:include href= parse= encoding=>`

FIXME: `<xi:fallback>`

FIXME: `xml:lang` attribute

FIXME: `xml:space` attribute

# Explicitly Unsupported features

* `flowRoot` element and its children - Inkscape, SVG 1.2 only., #13

* `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