-
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 chars scaling #4908
Fix chars scaling #4908
Conversation
Please fix the nit and squash the commits into one (see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits). |
The chars with measuredWidth less then width look terrible after scaling. Let to move it in center instead of scaling.
done |
Do you have a PDF file for us so we can test this patch, i.e. a PDF file with chars with measuredWidth less then width? |
Yes. Is it possible to attach it here? |
No, GitHub doesn't support attachments. You will have to use a hosting service, such as: Dropbox, Google Drive or similar. |
#3853 has a PDF which has quite a few with measuredWidth < width. and it has quite many where measuredWidth == width, which this PR would also improve by skipping the scaling. |
ctx.scale(characterScaleX, 1); | ||
scaledX /= characterScaleX; | ||
} else if (width > measuredWidth) { | ||
var d = (width - measuredWidth) / 2000; |
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.
A more descriptive variable is needed here. What is 'd'?
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://107.22.172.223:8877/32729af34b3dab5/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://107.21.233.14:8877/a264d16def04765/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/32729af34b3dab5/output.txt Total script time: 2.95 mins
Image differences available at: http://107.22.172.223:8877/32729af34b3dab5/reftest-analyzer.html#web=eq.log |
I didn't see #4964. @yurydelendik Should this be closed in favor of your PR? |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/a264d16def04765/output.txt Total script time: 22.92 mins
Image differences available at: http://107.21.233.14:8877/a264d16def04765/reftest-analyzer.html#web=eq.log |
@brendandahl I also proposed a different solution. However I think yurys code produced the best results on the pdfs I looked at. But what actually remains open is to solve the problem the original scaling code aimed to solve. |
Superseded by #6651 as that appears to solve this in a better way. |
Fix chars scaling for standard fonts. (redo of #4908)
The chars with measuredWidth less then width look terrible after scaling. Let to move it in center instead of scaling.