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

Add basic support for non-embedded Wingdings fonts #5463

Merged
merged 1 commit into from
Dec 18, 2014
Merged

Add basic support for non-embedded Wingdings fonts #5463

merged 1 commit into from
Dec 18, 2014

Conversation

Snuffleupagus
Copy link
Collaborator

This is a tentative patch that adds very basic support for non-embedded Wingdings fonts (a Windows version of Dingbats), by falling back to the ZapfDingbats encoding. Obviously this approach will not work perfectly, but in my opinion it seems to work reasonably well in pratice.

Instead of this very simple patch, another option would be to try and include more complete glyph data for Wingdings, e.g. a Unicode map and glyph widths, similar to what was done for ZapfDingbats.
However there is, in my opinion, one important difference between Wingdings and ZapfDingbats: ZapfDingbats is part of the 14 standard fonts, which in previous versions of the PDF specification was assumed to be available in PDF readers. To improve compatibility with older files, it thus makes sense for us to include data for ZapfDingbats.
However Wingdings has never been a standard font in PDF files, hence PDF files using it should thus contain all the necessary font data.

Given the above, I thus believe that it should be OK to fall back to ZapfDingbats for now. If non-embedded Wingdings fonts turns out to be a lot more common, then we can revisit this later.

Fixes #4301 completely.
Fixes #4837 almost completely. With this patch the bullets are displayed correctly, but the arrows are not of the correct type.
Fixes artofwar.pdf, pages 14 and 15.

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Nov 1, 2014

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/5f1c69575a56166/output.txt

@@ -1310,7 +1310,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (!properties.file) {
if (/Symbol/i.test(properties.name)) {
encoding = Encodings.SymbolSetEncoding;
} else if (/Dingbats/i.test(properties.name)) {
} else if (/Dingbats/i.test(properties.name) ||
/Wingdings/i.test(properties.name)) {
Copy link
Member

Choose a reason for hiding this comment

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

Collapse the two regular expressions into one: /Dingbats|Wingdings/i (also in fonts.js)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, thanks!

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Nov 2, 2014

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

pdfjsbot commented Nov 2, 2014

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/3cabcda031a3967/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 2, 2014

From: Bot.io (Windows)


Failed

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

Total script time: 2.98 mins

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

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

@pdfjsbot
Copy link

pdfjsbot commented Nov 2, 2014

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/3cabcda031a3967/output.txt

Total script time: 23.55 mins

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

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

@yurydelendik
Copy link
Contributor

really good, however I think the best place for that is nonStdFontMap. will it be possible to redo the logic based on that?

@yurydelendik yurydelendik self-assigned this Dec 5, 2014
@Snuffleupagus
Copy link
Collaborator Author

however I think the best place for that is nonStdFontMap. will it be possible to redo the logic based on that?

That seems to works just as well. Is the updated patch more in line with what you had in mind?

@yurydelendik
Copy link
Contributor

Yeah, something like that. I was actually curious if we still need changes in the symbolsFonts and the warning.

@Snuffleupagus
Copy link
Collaborator Author

I figured the warning was a good idea since, as I noted above, this PR isn't a complete solution for Wingdings support (but good enough for now in my opinion).

Edit: Sorry, I missed your comment about symbolsFonts. It (obviously) works just as well without it, so I've removed that part too.

@timvandermeij
Copy link
Contributor

The patch makes sense to me. I think the warning is fine in case the substitution is not perfect and people report an issue about it. It will give us a clue about what the issue is and how often it occurs, and it should not disturb the regular user if it's only visible in the console.

Good to go?

@@ -2500,6 +2501,10 @@ var Font = (function FontClosure() {
this.toFontChar[charCode] = fontChar;
}
} else if (/Dingbats/i.test(fontName)) {
if (name.search(/Wingdings/i) !== -1) {
Copy link
Member

Choose a reason for hiding this comment

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

Use /Windings/i.test(name) instead of name.search() !== -1.

This is a tentative patch that adds *very* basic support for non-embedded Wingdings fonts (a Windows version of Dingbats), by falling back to the ZapfDingbats encoding. Obviously this approach will not work perfectly, but in my opinion it seems to work reasonably well in pratice.

Instead of this very simple patch, another option would be to try and include more complete glyph data for Wingdings, e.g. a Unicode map and glyph widths, similar to what was done for ZapfDingbats.
However there is, in my opinion, one important difference between Wingdings and ZapfDingbats: ZapfDingbats is part of the 14 standard fonts, which in previous versions of the PDF specification was assumed to be available in PDF readers. To improve compatibility with older files, it thus makes sense for us to include data for ZapfDingbats.
However Wingdings has never been a standard font in PDF files, hence PDF files using it *should* thus contain all the necessary font data.

Given the above, I thus believe that it should be OK to fall back to ZapfDingbats for now. If non-embedded Wingdings fonts turns out to be *a lot* more common, then we can revisit this later.

Fixes 4301 completely.
Fixes 4837 almost completely. With this patch the bullets are displayed correctly, but the arrows are not of the correct type.
Fixes `artofwar.pdf`, pages 14 and 15.
@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

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

Total script time: 17.11 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

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

Total script time: 22.38 mins

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

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

@yurydelendik
Copy link
Contributor

/botio makeref

Thank you

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/649b044d23edc1f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/63c4f85855903de/output.txt

yurydelendik added a commit that referenced this pull request Dec 18, 2014
Add basic support for non-embedded Wingdings fonts
@yurydelendik yurydelendik merged commit 0c3a8ba into mozilla:master Dec 18, 2014
@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/649b044d23edc1f/output.txt

Total script time: 17.38 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/63c4f85855903de/output.txt

Total script time: 22.65 mins

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

@Snuffleupagus Snuffleupagus deleted the wingdings branch December 18, 2014 18:33
speedplane pushed a commit to speedplane/pdf.js that referenced this pull request Feb 24, 2015
Add basic support for non-embedded Wingdings fonts
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.

Document shows ÿ instead of bullets Bullets on first page replaced by letter 'n'
5 participants