bodoni / svg

Composer and parser for SVG
Other
302 stars 44 forks source link

The <textPath> element cannot set inner text #82

Closed hubenchang0515 closed 6 months ago

hubenchang0515 commented 6 months ago

The <textPath> element cannot set inner text

let text_path = TextPath::new();    // TextPath does not have arg to set text
let text = Text::new("xxxx");       // But Text does

the <textPath> should look like this:

<text>
    <textPath href="#MyPath">Quick brown fox jumps over the lazy dog.</textPath>
</text>
IvanUkhov commented 6 months ago

You see the text is a node nested in textPath; it is not an attribute. So you need to append it to your test_path. However, we provide an argument to new in such cases, and this one was missed. Fixed. Please try with TextPath::new("Quick brown fox jumps over the lazy dog.").