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

Correctly detect more cases of non-embedded Arial Black fonts (issue 7835) #7839

Merged
merged 1 commit into from Nov 22, 2016
Merged

Correctly detect more cases of non-embedded Arial Black fonts (issue 7835) #7839

merged 1 commit into from Nov 22, 2016

Conversation

Snuffleupagus
Copy link
Collaborator

This patch adds support for non-embedded Arial Black fonts, that use a Arial-Black... format for the font names.
Also, this patch changes canvas.js such that we always render Arial Black fonts with the maximum weight, which actually improves a number of existing test-cases. This should thus explain the test "failures", which are clear improvements compared with e.g. Adobe Reader.

Fixes #7835.

…7835)

This patch adds support for non-embedded Arial Black fonts, that use a `Arial-Black...` format for the font names.
Also, this patch changes `canvas.js` such that we always render Arial Black fonts with the maximum weight, which actually improves a number of existing test-cases. This should thus explain the test "failures", which are clear improvements compared with e.g. Adobe Reader.

Fixes 7835.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/ab4f4045ed65d8a/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/2f633eb06433d96/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/ab4f4045ed65d8a/output.txt

Total script time: 25.92 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/2f633eb06433d96/output.txt

Total script time: 26.97 mins

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

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

var bold = fontObj.black ? (fontObj.bold ? '900' : 'bold') :
(fontObj.bold ? 'bold' : 'normal');

var bold = fontObj.black ? '900' : (fontObj.bold ? 'bold' : 'normal');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Arial-Black == Arial-Black-Bold?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In practice this assumption seems to give better, i.e. closer to Adobe Reader, rendering in PDF.js for me locally on Windows (even if it doesn't manifest itself on the bots).
It actually seems that Adobe Reader might simply treat (non-embedded) ArialBlack-Bold the same as ArialBlack.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Having looked at this once more, ordinary ArialBlack should use a font weight that maps to black to render correctly (see https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#Common_weight_name_mapping).
However, ArialBlack,Bold should ideally map to an even heavier font weight, but given that no such one exists (in CSS), we will thus simply fallback to normal ArialBlack instead.

To me, this seems to give the best possible rendering (at least on Windows) for these non-embedded fonts; otherwise normal ArialBlack actually renders too light.

Edit: Perhaps I should add a comment about the specific handling of font.black here?

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

@Snuffleupagus
Copy link
Collaborator Author

Thanks for the review!

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/f6e68b70fcc2540/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/ff37c2cb8bf70e2/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/f6e68b70fcc2540/output.txt

Total script time: 26.02 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/ff37c2cb8bf70e2/output.txt

Total script time: 26.60 mins

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

@Snuffleupagus Snuffleupagus merged commit 9d8fb02 into mozilla:master Nov 22, 2016
@Snuffleupagus Snuffleupagus deleted the issue-7835 branch November 22, 2016 16:41
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Correctly detect more cases of non-embedded Arial Black fonts (issue 7835)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants