-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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 fallback for non-embedded "Century Gothic" CIDFontType2 font (issue 4722 and bug 879561) #5536
Conversation
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/ab685abb1ec06cc/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/e658838ca07af0d/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/e658838ca07af0d/output.txt Total script time: 17.14 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/ab685abb1ec06cc/output.txt Total script time: 22.76 mins
|
@@ -2467,7 +2471,7 @@ var Font = (function FontClosure() { | |||
|
|||
// if at least one width is present, remeasure all chars when exists | |||
this.remeasure = Object.keys(this.widths).length > 0; | |||
if (isStandardFont && type === 'CIDFontType2' && | |||
if (type === 'CIDFontType2' && (isStandardFont || stdFontMap[fontName]) && |
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'm confused about logic here, if I'm looking at that with lines above:
// The file data is not specified. Trying to fix the font name
// to be used with the canvas.font.
var fontName = name.replace(/[,_]/g, '-');
var isStandardFont = fontName in stdFontMap;
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
Shall we just change: var isStandardFont = (fontName in stdFontMap) || (fontName in nonStdFontMap);
?
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.
Yeah, I'm kind of confused too :-)
(I realized that this was bad after submitting the PR, but figured I'd wait for the review.)
I'd be slightly worried that I might possibly break some weird edge case by changing the isStandardFont
check, so I've attempted a slightly different solution.
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'd be slightly worried that I might possibly break some weird edge case by changing the isStandardFont check
Actually, that I wanted to change that. Below we are using isStandardFont, and looks like we need to apply the same logic for the re-mapped standard fonts.
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/e389537a175c698/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/52ce6c0ec95677e/output.txt |
the code falls back to Helvetica, the commit message still says arial. maybe you want to fix that before merging. |
Not really, but I suppose that I can do it anyway ;-) |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/e389537a175c698/output.txt Total script time: 17.34 mins
|
…ue 4722 and bug 879561) According to practical experiments, falling back to "Helvetica" when we encounter a non-embedded "[Century Gothic](http://en.wikipedia.org/wiki/Century_Gothic)" `CIDFontType2` font seems to work well. (Also, the section on Wikipedia about "Printer ink usage" *might* provide some anecdotal evidence that Century Gothic is a fairly standard sans-serif font.) Obviously this patch doesn't make "Century Gothic" fonts render perfectly, as is often the case with non-embedded fonts, but all the text is now legible in the referenced issues. Fixes 4722. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=879561.
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/52ce6c0ec95677e/output.txt Total script time: 22.98 mins
|
/botio makeref Thank you for the fix. |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 1 Live output at: http://107.22.172.223:8877/868fd213dc5e421/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 1 Live output at: http://107.21.233.14:8877/afc9ea3ff78f063/output.txt |
Add fallback for non-embedded "Century Gothic" CIDFontType2 font (issue 4722 and bug 879561)
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/868fd213dc5e421/output.txt Total script time: 17.58 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/afc9ea3ff78f063/output.txt Total script time: 22.88 mins
|
Add fallback for non-embedded "Century Gothic" CIDFontType2 font (issue 4722 and bug 879561)
According to practical experiments, falling back to "Helvetica" when we encounter a non-embedded "Century Gothic"
CIDFontType2
font seems to work well.(Also, the section on Wikipedia about "Printer ink usage" might provide some anecdotal evidence that Century Gothic is a fairly standard sans-serif font.)
Obviously this patch doesn't make "Century Gothic" fonts render perfectly, as is often the case with non-embedded fonts, but all the text is now legible in the referenced issues.
Fixes #4722.
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=879561.
Edit: Both the issues referenced contains files that were exported from SolidWorks.