-
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
SVG: Don't render missing glyphs #8785
Conversation
This bug is similar to the canvas bug of mozilla#6721. I found this bug when I tried to run pdf2svg on a SVG file, and the generated SVG could not be viewed in Chrome due to a SVG/XML parsing error: "PCDATA invalid Char value 3" Reduced test case: - https://github.com/mozilla/pdf.js/files/1229507/pcdatainvalidchar.pdf - expected: "hardware performance" - Actual SVG source: "hardware\x03performance" (where "\x03" is a non-printable character, and invalid XML). In terms of rendering, this bug is similar to mozilla#6721, where an unexpected glyph appeared in the canvas renderer. This was fixed by mozilla#7023, which skips over missing glyphs. This commit follows a similar logic. The test case from mozilla#6721 can be used here too: - https://github.com/mozilla/pdf.js/files/52205/issue6721_reduced.pdf expected: "Issue 6721" actual (before this patch): "Issue ààà6721"
2941dc3
to
f07ce2b
Compare
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/d3673cdf35b4ecb/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/d3673cdf35b4ecb/output.txt Total script time: 2.35 mins Published |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/f8aa5e6f8b8039b/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.215.176.217:8877/76d0a9ffaa84bce/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/f8aa5e6f8b8039b/output.txt Total script time: 16.44 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/76d0a9ffaa84bce/output.txt Total script time: 29.30 mins
|
Thank you for fixing this! |
SVG: Don't render missing glyphs
This bug is similar to the canvas bug of #6721, which was fixed by #7023
See commit description for more info and test cases.
New reduced test case introduced with this PR:
node examples/node/pdf2svg.js pcdatainvalidchar.pdf
): "hardware\x03performance"(I did not add an automated test because we don't have any ref test framework for SVG (e.g. painting SVG on a canvas, and then doing an image comparison, as done in #5863 - somehow that issue was closed without follow-up...).
The test case from #6721 can be used here too: