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

Missing support for text elements #10

Open
meyfa opened this issue Nov 5, 2016 · 5 comments
Open

Missing support for text elements #10

meyfa opened this issue Nov 5, 2016 · 5 comments
Labels
feature New feature or request

Comments

@meyfa
Copy link
Owner

meyfa commented Nov 5, 2016

There is no support for the <text> element and its possible child elements, like <tspan> or <font>.

@meyfa meyfa added the enhancement Improvement to an existing feature label Nov 5, 2016
@meyfa meyfa added feature New feature or request and removed enhancement Improvement to an existing feature labels Dec 12, 2016
@MukeshHome
Copy link

Hi,

Please do needful for text and tspan tag parsing.

Thanks,
Mukesh

@thomas-kl1
Copy link
Contributor

thomas-kl1 commented Jan 29, 2018

Does anyone working on it?
Actually I need it for a project, so maybe I can help. I'll add the nodes "text" and "textPath".

UPDATE: It's quite urgent for me, I'll open a pull request with what I've already done for text, but feel free to give any guidelines and what I should do in order to help you.

UPDATE: How should I implement the methods rasterize? Have you any documentation?

@meyfa
Copy link
Owner Author

meyfa commented Jan 30, 2018

This feature is immensely important, for sure. There are a few caveats though:

  • <tspan> elements can be nested arbitrarily inside <text>. The problem with this is that the whole library is built upon the idea that every node contains either nothing, text, or child nodes, but not a mixture of both text and nodes.
  • Rasterizing text with the gd extension is also next to impossible when keeping in mind that it needs to be able to have stroke, letter spacing, and so on. Moreover, many servers will not have fonts installed, so font loading needs to be handled.

I did not yet have the time to come up with solutions.

@thomas-blackbird

Contributions are always welcome, so if you have figured something out, feel free to open a PR or add information to this issue :)

The rasterize method should invoke a custom renderer class through the given SVGRasterizer instance's render method. The renderer class needs to implement a method for rendering the stroked version of the shape (in this case, the text) and a method for rendering the filled-in version of the shape (text). See SVGEllipseRenderer.php for the most simple example. But, keep the aforementioned problems in mind.

@meyfa
Copy link
Owner Author

meyfa commented Feb 10, 2018

Support for <text> and <textPath> reading/writing was added in commit c628ff3 through PR #42 by @thomas-blackbird (thank you!). This issue will stay open because the following are still unsupported:

  • <tspan>
  • rasterizer support
  • arbitrary nesting of text nodes

@meyfa
Copy link
Owner Author

meyfa commented Jul 24, 2018

Text rendering is now partially supported through PR #54.

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

No branches or pull requests

3 participants