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

bug in svg export of text, empty spaces are rendered. #4521

Closed
blobinabottle opened this issue Nov 30, 2017 · 5 comments · Fixed by #4524
Closed

bug in svg export of text, empty spaces are rendered. #4521

blobinabottle opened this issue Nov 30, 2017 · 5 comments · Fixed by #4524

Comments

@blobinabottle
Copy link
Contributor

Version

2.0 (and all since forever I think :-))

Test Case

http://fabricjs.com/test/svg_export/text.html
Or any text exported as SVG
screen shot 2017-11-30 at 16 11 00

Steps to reproduce

Try select the text, you'll see a white space used for nothing.
This can be really problematic with fonts like
https://fonts.google.com/specimen/Zilla+Slab+Highlight
You clearly see a useless rectangle on top of everything :
screen shot 2017-11-30 at 16 09 31

And I saw in the svg code that the before the first there is some white spaces, if we remove these spaces, the rectangle disappear and you get a clean svg text rendered.

I hope you'll see how to fix this! :-)

Thanks!

@asturur
Copy link
Member

asturur commented Dec 1, 2017

probably the new lines and tabs for svg formatting do not help.
Also we need a better way to handle text-wrap and white space props.

@asturur
Copy link
Member

asturur commented Dec 2, 2017

i do not really like it but first thing we should do is stop pretty formatting the svg in the text.
And this i am doing. All the tabs and newlines get rendered.

@asturur
Copy link
Member

asturur commented Dec 2, 2017

is from when we inserted the white-space preserve, is a 2.0 thing

@blobinabottle
Copy link
Contributor Author

Ah yes, the white-space preserve is for Safari compatibility right?

@asturur
Copy link
Member

asturur commented Dec 2, 2017

is for keeping spaces between tspans, and multiple spaces that would be otherwise eaten by svg.

if you write A B and A is red and B is blue, a tspan with B inside is rendered as B.

Svg stuff....

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

Successfully merging a pull request may close this issue.

2 participants