Skip to content
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

Enforce line width to be at least 1px after applied transform #12812

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

calixteman
Copy link
Contributor

@calixteman calixteman commented Jan 4, 2021

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides some inline comment; can we add a reference-test for this?

src/display/canvas.js Outdated Show resolved Hide resolved
// Heuristic value used when enforcing minimum line widths.
const MIN_WIDTH_FACTOR = 0.65;
// Enforce line to have a minimal width of 1px when transform is applied
const MIN_WIDTH_FACTOR = 1.000001;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, given all the different getSinglePixelWidth and MIN_WIDTH_FACTOR usages throughout this file; are these changes generally correct/safe (as in not regressing existing tests)?

Unfortunately PR #4615 landed without a test-case included, so please also manually test the issues/bugs listed there to ensure that you're not regressing anything here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked all the pdf mentioned in the above PR and they all looks good.
I ran locally ref tests and the differences are minimal.
I'd say that with my eyes the rendering on firefox-linux and on acrobat-windows are very close (same screen).

src/shared/util.js Outdated Show resolved Hide resolved
src/shared/util.js Outdated Show resolved Hide resolved
src/shared/util.js Outdated Show resolved Hide resolved
@janpe2
Copy link
Contributor

janpe2 commented Jan 5, 2021

Does this PR improve also the rendering of issue #12295? The problems in that issue are caused by the existing implementation of getSinglePixelWidth() because the scaling factors differ greatly in the horizontal and vertical direction.

 * add a comment to explain how minimal linewidth is computed.
 * when context.linewidth < 1 after transform, firefox and chrome
   don't render in the same way (issue mozilla#12810).
 * set lineWidth to 1 after transform and before stroking
   - aims fix issue mozilla#12295
   - a pixel can be transformed into a rectangle with both heights < 1.
     A single rescale leads to a rectangle with dim equals to 1 and
     the other to something greater than 1.
 * change the way to render rectangle with null dimensions:
   - right now we rely on the lineWidth set before "re" but
     it can be set after "re" and before "S" and in this case the rendering
     will be wrong.
   - render such rectangles as a single line.
@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/dcbfeb0b8d4948f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/3d6d8cec570cfc5/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/dcbfeb0b8d4948f/output.txt

Total script time: 21.59 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Integration Tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/dcbfeb0b8d4948f/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/3d6d8cec570cfc5/output.txt

Total script time: 27.14 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://3.101.106.178:8877/3d6d8cec570cfc5/reftest-analyzer.html#web=eq.log

@brendandahl
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @brendandahl received. Current queue size: 0

Live output at: http://54.67.70.0:8877/3f829b52819efd4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @brendandahl received. Current queue size: 0

Live output at: http://3.101.106.178:8877/106cd75734b80c5/output.txt

@brendandahl brendandahl merged commit 6619f1f into mozilla:master Jan 14, 2021
@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/3f829b52819efd4/output.txt

Total script time: 24.82 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/106cd75734b80c5/output.txt

Total script time: 26.49 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants