This project is read-only.

SvgText element isn't added to the file

Jul 6, 2016 at 3:00 PM
I've been trying to add some text to my SvgDocument but the text doesn't appear and when I look at the file in a text editor the element hasn't actually been added.

I've created the text element like so:
 SvgText title = new SvgText("Title Goes Here");
I've then set the x and y co-ordinates, font and font size like so:
           var unitCol = new SvgUnitCollection();
            unitCol.Add(25);

            var unitCol2 = new SvgUnitCollection();
            unitCol2.Add(250);

            title.X = unitCol;
            title.Y = unitCol2;
            title.FontSize = 8;
            title.Font = "Arial";
Then I've added the text element to my document like so:
svgDoc.Children.Add(title);
All of the other elements appear but not the text, can anyone tell me what I'm doing wrong?
Jul 19, 2016 at 9:22 PM
I don't have an answer for you but I'm having the same problem. Even if it is just a blank text element, it won't show up when I write the document to a .svg file. I wish there was more documentation on this library.
Jul 20, 2016 at 2:52 PM
I found the answer on the Issues page on the github for this project (https://github.com/vvvv/SVG/issues/192)

User w0q said: The text is not rendered if the tag <text> contains no child elements. The following code displays the text:
svgText.Nodes.Add(new SvgContentNode(){ Content = "some text" }).

I guess the Text property of the <text> element has no functionality.