Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tspan tags are ignored when parsing text #64

Open
nsorin opened this issue Nov 26, 2020 · 4 comments
Open

tspan tags are ignored when parsing text #64

nsorin opened this issue Nov 26, 2020 · 4 comments
Milestone

Comments

@nsorin
Copy link

nsorin commented Nov 26, 2020

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.

@bsweeney bsweeney added this to the 0.4.2 milestone Apr 8, 2022
@c-ancia
Copy link

c-ancia commented Apr 28, 2022

Hi there,

We are also experiencing these two issues, the tspan text of our SVGs are either not at the appropriate place or their font size is too small to be readable.

Do you have an ETA on a fix please? I don't mean to be pushy, I am just trying to assess what is the best course of action for us. :)

Many thanks!

@bsweeney
Copy link
Member

Sorry to say I don't have an ETA at this time.

@c-ancia
Copy link

c-ancia commented Apr 29, 2022

Thanks for letting me know, at least we can take a decision from this and we'll just follow the progress on this issue. 👍🏻

@fateenarinah
Copy link

Any progress on this? I'm experiencing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants