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

Attempt to fallback to a default font, for non-available ones, in PartialEvaluator.loadFont #11218

Merged
merged 1 commit into from Oct 10, 2019

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Oct 8, 2019

Fixes #11068
Fixes #11162

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/2ff030e7576aecf/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/4b6eb95bbe54810/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/2ff030e7576aecf/output.txt

Total script time: 17.76 mins

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

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

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/4b6eb95bbe54810/output.txt

Total script time: 26.25 mins

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

Image differences available at: http://54.215.176.217:8877/4b6eb95bbe54810/reftest-analyzer.html#web=eq.log

src/core/evaluator.js Outdated Show resolved Hide resolved
@Snuffleupagus Snuffleupagus marked this pull request as ready for review October 8, 2019 12:23
@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/52474df625220b6/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/af785733b9ed0ab/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/52474df625220b6/output.txt

Total script time: 17.76 mins

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

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

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/af785733b9ed0ab/output.txt

Total script time: 25.96 mins

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

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

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

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

@pdfjsbot
Copy link

pdfjsbot commented Oct 8, 2019

From: Bot.io (Linux m4)


Success

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

Total script time: 1.67 mins

Published

@Snuffleupagus
Copy link
Collaborator Author

@timvandermeij Please note that I'm not entirely sure about the way forward here!
I wasn't really able to make sense of #11191 (comment), and there wasn't any requests for clarification on any specific comment, and thus I decided to (quickly) try and implement my idea just to see if it'd actually work as expected.

warn('fontRes not available');
return errorFont();
warn(`fontRes "${fontName}" not available.`);
// Attempting to fallback, see the code-path just below...
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should put this in the warning here/below instead (or both) so it's clear from the console that this is a recovery path. We did this before for some other recovery messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point; I've removed the (frankly) unnecessary warning duplication, and also added different warning messages depending on whether the fallback/Error paths are taken.

@timvandermeij
Copy link
Contributor

The patch itself looks clear to me and seeing the reference images this does seem to address the issue. I have one comment above. Looking at the other patch after the updates, I don't see too many differences anymore.

@Snuffleupagus
Copy link
Collaborator Author

Looking at the other patch after the updates, I don't see too many differences anymore.

Since my intention wasn't to step all over the other patch, and I threw this one together before seeing the updated version, I'm just not sure how we should proceed here!?

However, the other one still has a couple of issues with the implementation (it's not as complete as it ought to be, and it also abuses Dict/Name-structures a bit).

@timvandermeij
Copy link
Contributor

I would say we can continue with this more complete patch, but use https://help.github.com/en/articles/creating-a-commit-with-multiple-authors to credit both authors for the work.

…rtialEvaluator.loadFont`

This handles the two different ways that fonts can be loaded, either by Name (which is the common case) or by Reference.
Furthermore, this also takes the `ignoreErrors` option into account when deciding whether to fallback or Error.
Finally, by creating a minimal but valid Font dictionary, there's no special-cases necessary in any of the font parsing code.

Co-authored-by: huzjakd <huzjakd@gmail.com>
Co-Authored-By: Jonas Jenwald <jonas.jenwald@gmail.com>
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/36e499ea441ae23/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/fb378d4ef415a88/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/36e499ea441ae23/output.txt

Total script time: 17.78 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/fb378d4ef415a88/output.txt

Total script time: 26.35 mins

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

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

@timvandermeij timvandermeij merged commit d20ab76 into mozilla:master Oct 10, 2019
@timvandermeij
Copy link
Contributor

Nice work!

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/28b2e0ed4d8a40f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/9a94ba642a9779a/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/28b2e0ed4d8a40f/output.txt

Total script time: 16.16 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/9a94ba642a9779a/output.txt

Total script time: 24.43 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
Projects
None yet
4 participants