Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Request #12961 can't insert svg elements with addText
Submitted: 2008-01-23 03:15 UTC
From: adrianbj Assigned:
Status: Open Package: Image_Canvas (version 0.3.1)
PHP Version: 5.2.5 OS: Debian
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-23 03:15 UTC] adrianbj (Adrian Jones)
Description: ------------ In SVG.php, there is a line in the addText function: htmlspecialchars($text) . Unfortunately, this prevents the use of svg elements such as <tspan>. Removing the htmlspecialchars fixes the problem, but I do see why you added it, so there might be a better way to fix the problem. Expected result: ---------------- SVG elements such as <tspan> should be applied to the text Actual result: -------------- the elements themselves are actually printed along with the text

Comments

 [2009-08-19 04:58 UTC] doconnor (Daniel O'Connor)
In general, when it's an XML document and the method is named 'addText' or similar, it implies a TextNode to me. Perhaps you could make use of _addElement() if it were public.
 [2009-12-27 00:45 UTC] neufeind (Stefan Neufeind)
-Type: Bug +Type: Feature/Change Request
But when using _addElement() (if it were public) he'd need to apply positioning, rotation etc. himself as well, since that's used around the text (see call to _addElement() in addText()). So how about we introduce some kind of param for "pre-encoded text" that points out it's already HTML/SVG-encoded and doesn't try to convert with htmlspecialchars again? Question remains however if somebody might want to some different kind of text/object or other attributes for the text? In that case we'd maybe need some general "addSVGObject()" that adds an object but takes care of tranformation (rotation, moving, ...) for the user? About your original inquiry: Since addText() is the same for all output-drivers, it's expected functionality that it usually encodes all special characters - so that part "works as designed". Marking this as feature-request.