Skip to content

Commit

Permalink
Always choose a (3, 1) cmap table for TrueType fonts that have an enc…
Browse files Browse the repository at this point in the history
…oding specified, regardless of the Symbolic font flag (bug 1337429)

This patch basically reverts one aspect of TrueType (3, 1) cmap parsing to the state prior to PR 4259. After that PR, a number of regressions occurred in this particular code-path, which necessitated a number of follow-ups such as PRs 5703, 5743, and 6425.
The empirical data suggests, at least to me, that we should always prefer a (3, 1) cmap for TrueType fonts when they have an encoding, regardless of the Symbolic font flag.

Obviously this patch passes all unit/font/reference tests locally, and I made sure that all the PRs mentioned above landed with test-cases included.
However, in my opinion, there's still a very real possibility that this patch could potentially cause new regressions.

Given that the PDF file in bug 1337429 has been broken for almost *three* years before anyone noticed, and considering that the code-path in question has been the source of numerous regressions, I do *not* intend to request uplift of this patch to previous Firefox versions (assuming that it's even accepted).

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1337429.
  • Loading branch information
Snuffleupagus committed Feb 15, 2017
1 parent b509a3f commit ce07202
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ var Font = (function FontClosure() {
// Continue the loop since there still may be a higher priority
// table.
} else if (platformId === 3 && encodingId === 1 &&
((!isSymbolicFont && hasEncoding) || !potentialTable)) {
(hasEncoding || !potentialTable)) {
useTable = true;
if (!isSymbolicFont) {
canBreak = true;
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
!bug1146106.pdf
!bug1252420.pdf
!bug1308536.pdf
!bug1337429.pdf
!issue5564_reduced.pdf
!canvas.pdf
!bug1132849.pdf
Expand Down
Binary file added test/pdfs/bug1337429.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,13 @@
"rounds": 1,
"type": "eq"
},
{ "id": "bug1337429",
"file": "pdfs/bug1337429.pdf",
"md5": "4e6e4dfdab884e9465bdce657b590028",
"link": false,
"rounds": 1,
"type": "eq"
},
{ "id": "glyph_accent",
"file": "pdfs/glyph_accent.pdf",
"md5": "1526e4edaa3ec439ebf156d0a0b385aa",
Expand Down

0 comments on commit ce07202

Please sign in to comment.