-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Hello,
I am trying to display SVG images with text in them in using dompdf (which depends on this library for SVG rendering). Some of my text is divided into <tspan>
elements, because it is too long to be displayed in a single line. In a browser, the image is rendered correctly. In dompdf, however, the text is displayed in a single line. For example the following <text>
tag:
<text x="10" text-anchor="start" class="highcharts-caption" data-z-index="4" style="color:#666666;font-size:11px;fill:#666666;" y="368">
<tspan>This is an example text. The text is too long to be displayed in a single line, so it has to be</tspan>
<tspan dy="14" x="10">broken down into multiple parts using the tspan tag.</tspan>
</text>
is displayed as:
"This is an example text. The text is too long to be displayed in a single line, so it has to bebroken down into multiple parts using the tspan tag."
As you can see, the line break is ignored. "be" and "broken" end up merged together.
I used a debugger to look into how this library handles the text, and it turns out the <tspan>
tag is not recognized at all. It is simply removed from the text. Which means my previous example is interpreted as:
<text x="10" text-anchor="start" class="highcharts-caption" data-z-index="4" style="color:#666666;font-size:11px;fill:#666666;" y="368">
This is an example text. The text is too long to be displayed in a single line, so it has to bebroken down into multiple parts using the tspan tag.
</text>
The <tspan>
Tag is part of the SVG specification and should not be ignored by this library. Any chance for a fix?
Thank you for the support.