-
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
Override the minimum font size when rendering the text layer #18283
Override the minimum font size when rendering the text layer #18283
Conversation
e2d9297
to
8c11334
Compare
3c603a2
to
c6a3bbd
Compare
This is ready for review. I couldn't run the full test suite locally because Also, I couldn't add a test for Chrome because it seems like it's impossible to set its "Settings > Appearance > Customise fonts > Minimum font size" option through puppeteer (the only way to change it programmatically is through the extensions API, but writing a Chrome extension for this test seems overkill) |
Nit for the commit message: s/Overrride/Override. Let's trigger a round of tests: /botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/674ae2965e56596/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/2c26c2e6f59439f/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/674ae2965e56596/output.txt Total script time: 28.92 mins
Image differences available at: http://54.241.84.105:8877/674ae2965e56596/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/2c26c2e6f59439f/output.txt Total script time: 44.77 mins
Image differences available at: http://54.193.163.58:8877/2c26c2e6f59439f/reftest-analyzer.html#web=eq.log |
Uhm, taking a look at the integration failures 🤔 It didn't fail locally for some reason |
Note that most of them are known intermittents, see https://github.com/mozilla/pdf.js/issues?q=is%3Aopen+is%3Aissue+label%3Aintermittent for the associated issues, so I think only the |
c6a3bbd
to
23f3cb7
Compare
There was some variability on the exact number of pixels across different platforms (and across different browsers on the same OS, even if the test only checks Firefox), so I relaxed the assertion to be "the with must be within 3% of 315px". Without the fix the width is more than 200% of the expected with, so a 3% tolerance is ok to verify that the fix is being applied. I don't have access to a windows machine, could you re-run the bot? |
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/dbd55648b66ba65/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/7c447b81f825640/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/dbd55648b66ba65/output.txt Total script time: 7.91 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/7c447b81f825640/output.txt Total script time: 19.68 mins
|
One of the two remaining windows failures is a flaky tests (#17931), the other one is a timeout also related to pasting ( |
Yes, both are flaky tests and the failures are unrelated to this PR, so the tests here should now be OK. |
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.
The change looks good to me, but I'd also prefer a review from @Snuffleupagus to make sure that the comments/concerns from the original PR #14427 are fully resolved here. Thanks!
Unfortunately it seems that the new integration test added in this PR has intermittent shutdown issues, based on the logs in http://54.241.84.105:8877/dbd55648b66ba65/output.txt:
|
I think the problem is that pretty much all integration tests call pdf.js/test/integration/test_utils.mjs Lines 83 to 94 in 658b5fa
However, in this new integration test, and also in other tests in this file, this pattern is not used and a separate browser is spawned instead. This is for good reason, but instead of only calling We have a reference to the pages in the separate browser in these tests, so we should be able to close the page in a similar way to fix the issue. |
I have fixed the issue for the existing test in f4053c2, which should make it a bit easier to mirror that approach for this test and that should solve the shutdown issue identified above. |
Thank you! I'll rebase and fix it. |
23f3cb7
to
221518f
Compare
Could you rebase this patch once more onto the current master branch, now that all other test framework fixes have landed? I'll retrigger the tests here afterwards. |
221518f
to
ffcefe2
Compare
Done 👍 |
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.241.84.105:8877/efb440126e25425/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.193.163.58:8877/d1053db49ae6092/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/efb440126e25425/output.txt Total script time: 7.91 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/d1053db49ae6092/output.txt Total script time: 19.06 mins
|
The remaining failure on Linux is #17931. |
2f1b526
to
b0bcd06
Compare
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.
r=me, with the final comments addressed and all tests passing; thank you!
Browsers have an accessibility option that allows user to enforce a minimum font size for all text rendered in the page, regardless of what the font-size CSS property says. For example, it can be found in Firefox under `font.minimum-size.x-western`. When rendering the <span>s in the text layer, this causes the text layer to not be aligned anymore with the underlying canvas. While normally accessibility features should not be worked around, in this case it is *not* improving accessibility: - the text is transparent, so making it bigger doesn't make it more readable - the selection UX for users with that accessibility option enabled is worse than for other users (it's basically unusable). While there is tecnically no way to ignore that minimum font size, this commit does it by multiplying all the `font-size`s in the text layer by minFontSize, and then scaling all the `<span>`s down by 1/minFontSize.
b0bcd06
to
5b29e93
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/de1f5d47520022a/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/1cee9608bb46e28/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/de1f5d47520022a/output.txt Total script time: 28.84 mins
Image differences available at: http://54.241.84.105:8877/de1f5d47520022a/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/1cee9608bb46e28/output.txt Total script time: 45.22 mins
Image differences available at: http://54.193.163.58:8877/1cee9608bb46e28/reftest-analyzer.html#web=eq.log |
Thank you for fixing this! |
Thanks for the reviews! |
Fixes #14426
Commit message:
This PR detects the min font size similarly to #14427, with a few changes:
getBoundingClientRect().height
rather thangetComputedStyle().fontSize
, becausegetComputedStyle().fontSize
returns the minimum font size in Chrome and Safari but not in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1903360)Marking as draft because I still have to run all the tests locally, and add a new test.