-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Multiple spaces in PDF being squashed to single space in iOS during SVG conversion #8935
Comments
SVG is an XML format. |
Perhaps it could be a symptom of https://bugs.webkit.org/show_bug.cgi?id=112032 |
That is the exact issue you are documenting here. The bug above lists a workaround to add xml:space="preserve" to each tspan, but this will increase document size and memory usage. |
I made a pull request that will prevent the spaces from collapsing, but the overhead is of course unnecessary unless using webkit |
I'm not sure if this issue is still relevant after PR #9340, even beside the fact that the SVG-backend isn't officially supported; please note https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#backends With PR #9340, which fixed a very large number of font bugs, we're now moving all glyphs to the Private Use Area (PUA) since that both fixes and prevents a large number of glyph mapping issues. |
Link to PDF file (or attach file here):
double_spaces.pdf
Configuration:
Steps to reproduce the problem:
What is the expected behavior? (add screenshot)
Here is the PDF generated on desktop. The double spaces in the PDF are mirrored here.
What went wrong? (add screenshot)
iOS is automatically squashing multiple spaces to a single space. I verified that the SVG converter generated the correct glyphs, but when the correct string ("double spaces double spaces") was assigned to the svg element's text content, the double spaces disappeared. The reason for this is logical: multiple spaces in HTML are considered to be no different than a single space.
However, desktop chrome conveniently ignores this, and renders multiple spaces with no problem. Is there a way that we can trick iOS into inserting the multiple spaces? I wondered if we could use non-breaking spaces in place of spaces to get the same functionality...
The text was updated successfully, but these errors were encountered: