|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Defines a graphics element consisting of text.
The <text> element renders a string of text as a proper graphics primitive. Unlike text rasterized into a bitmap, SVG text is fully live: it remains selectable and searchable, scales cleanly to any resolution, and accepts every normal SVG presentation attribute — fill, stroke, opacity, transform, gradients via url(#id), filters, clip paths, and so on. Fonts are loaded through standard CSS @font-face rules (TTF, OTF, WOFF, WOFF2) or fall back to a built-in typeface when no match is available.
Use <text> for labels, titles, axis tick marks, captions, and any other readable content. Substrings inside a <text> can be re-styled or repositioned with "<tspan>", and text can be made to follow an arbitrary curve with "<textPath>".
| Attribute | Default | Description |
|---|---|---|
| lengthAdjust | spacing | "spacing" or "spacingAndGlyphs". Indicates how the text may stretch (extra letter spacing only, or glyph-stretch as well). |
| x | 0 | If a single value is provided, sets the absolute x-position of the first character. If multiple values, sets positions per glyph. |
| y | 0 | Similar to x, but for y-position. |
| dx | (none) | One or more relative x shifts (optional). |
| dy | (none) | One or more relative y shifts (optional). |
| rotate | (none) | A list of rotation values per character (optional). |
| textLength | (none) | Author-specified total text advance length for calibration. |