SVG <use> elements cannot reference <tspan> elements

RESOLVED INVALID

Status

()

Core
SVG
--
minor
RESOLVED INVALID
a year ago
a year ago

People

(Reporter: bugzillabug576468, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

a year ago
When a <tspan> element is referenced by a <use> element, its inner text content is not rendered, making it invisible.

To reproduce, please load the SVG below in any Firefox. The "referenced text" will only display once for the original <tspan>, but not for its 2 references. To see how it should be displayed, load the same SVG in Inkscape.

(As a sidenote: For standalone texts, a workaround is to have the <use> element reference an entire <text> element instead, which is correctly rendered. However, this is not possible for <textPath> content, since a <textPath> already needs a surrounding <text> element, and Firefox does not display <text> elements nested within other <text> elements, possibly due to another bug. If you know any other workaround, please let me know.)

Thank you for all you great work on this astonishing piece of software.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="500">
<g transform="translate(50,50)">
<path id="mypath" stroke="red" fill="none" d="M 10,100 C 70,100 100,150 100,180" />
<text><tspan id="mytspan">referenced text</tspan></text> <!-- this is displayed -->
<text dy="20"><use fill="red" xlink:href="#mytspan" /></text> <!-- this is NOT displayed -->
<text>
<textPath xlink:href="#mypath">
<tspan>direct text</tspan> <!-- this is displayed -->
<use fill="red" xlink:href="#mytspan" /> <!-- this is NOT displayed -->
</textPath>
</text>
</g>
</svg>

Comment 1

a year ago
Created attachment 8872036 [details]
1367888.svg

Comment 2

a year ago
Created attachment 8872037 [details]
screenshot-ff53-chrome58.png

FF and Chrome have the same rendering.
While you can point a use at a tspan or textPath it won't render anything. tspan or textPath must have a text element parent.

https://www.w3.org/TR/SVG2/text.html#TextLayoutAlgorithm
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.