-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Use FDSelect and FDArray when converting CFF CID font to paths #9501
Conversation
src/core/font_renderer.js
Outdated
if (fdIndex >= 0 && fdIndex < this.fdArray.length) { | ||
let fontDict = this.fdArray[fdIndex]; | ||
fontMatrix = fontDict.getByName('FontMatrix') || | ||
[0.001, 0, 0, 0.001, 0, 0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use FONT_IDENTITY_MATRIX
from src/shared/util.js
rather than hard-coding this array here.
3d6e38a
to
5c6480b
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://54.67.70.0:8877/5db93e0ca81cae5/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @brendandahl received. Current queue size: 0 Live output at: http://54.215.176.217:8877/decf1a6b3006873/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/5db93e0ca81cae5/output.txt Total script time: 2.14 mins
Image differences available at: http://54.67.70.0:8877/5db93e0ca81cae5/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/decf1a6b3006873/output.txt Total script time: 3.97 mins
Image differences available at: http://54.215.176.217:8877/decf1a6b3006873/reftest-analyzer.html#web=eq.log |
test/test_manifest.json
Outdated
"file": "pdfs/text_clip_cff_cid.pdf", | ||
"md5": "92d4920586f177cc0e83326e5b5d2ee1", | ||
"rounds": 1, | ||
"type": "eq", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing comma needs to be removed.
5c6480b
to
c062ea5
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/9a9d95e9e9087fe/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/37ddc74c598d548/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/9a9d95e9e9087fe/output.txt Total script time: 18.16 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/37ddc74c598d548/output.txt Total script time: 24.37 mins
|
@brendandahl Could you take another look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+ pending the one little change
src/core/font_renderer.js
Outdated
if (!code || code.length === 0 || code[0] === 14) { | ||
return noop; | ||
} | ||
|
||
let fontMatrix = this.fontMatrix; | ||
if (this.isCFFCIDFont) { | ||
let fdIndex = this.fdSelect.getFDIndex(glyphId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment here about why we ignore the top dict's font matrix (similar to your comment in the PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment.
c062ea5
to
8ea5055
Compare
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://54.215.176.217:8877/37cc81a8f3dd848/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @brendandahl received. Current queue size: 0 Live output at: http://54.67.70.0:8877/abc72fd55ce35e7/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/abc72fd55ce35e7/output.txt Total script time: 16.93 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/37cc81a8f3dd848/output.txt Total script time: 22.45 mins
|
Thanks for pull request! |
Use FDSelect and FDArray when converting CFF CID font to paths
Fixes #9355
When text rendering mode
Tr
specifies that text should produce clipping paths, font's glyphs are converted to canvas paths infont_renderer.js
. However, it ignores entries FDSelect and FDArray in CFF CID fonts. Those entries are needed to get the correct FontMatrix (and to execute local subroutines).The font in issue #9355 has no FontMatrix in the Top DICT, so
font_renderer.js
uses the default matrix, which is[0.001 0 0 0.001 0 0]
. The correct FontMatrix is in the FDArray and it specifies about 50% smaller scaling factors:[.00048828099 0 0 .00048828099 0 0]
.I have ignored Top DICT's FontMatrix because
CFFParser
always removes and copies it to FDArray dictionaries when needed.