-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Fix char spacing bug in SVG mode #8340
Conversation
We need a test case or sample pdf to investigate and confirm the fix. |
https://onedrive.live.com/?authkey=%21AD5_eL-XSe5apaY&cid=A1E9796EF74E34CD&id=A1E9796EF74E34CD%211473&parId=root&o=OneUp |
It's hard to understand the fix. Can you explain it in terms of SVG and PDF32000 specs? |
src/display/svg.js
Outdated
@@ -689,14 +689,16 @@ SVGGraphics = (function SVGGraphicsClosure() { | |||
x += -glyph * fontSize * 0.001; | |||
continue; | |||
} | |||
current.xcoords.push(current.x + x * textHScale); | |||
var character = glyph.fontChar; | |||
if (character !== ' ') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if character == ' '
it does not mean it's "empty", glyph can still display something.
@yurydelendik I was just thinking that these blanks had no effect on the display... minify svg should actually be done in my own project rather than in pdf.js, I have removed this part of code |
Looks better. Could you squash the two commits into one (see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits)? |
Thank you for the patch. |
Fix char spacing bug in SVG mode
When use svg mode, a word which first char is blank won't get accurate position. Because canvas mode renders well, I compared code between them and found some code in svg mode was too old. I just modify the code which make my pdf looks bad, but I'm not sure there's any other bugs in other condition like
font.vertical = true
. Nevertheless, this PR won't trigger any new problems.Here's my example