mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 00:28:06 +02:00
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](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.
This commit is contained in:
parent
a018e933ea
commit
d8b905048b
4 changed files with 127 additions and 1 deletions
|
@ -320,9 +320,12 @@ var stdFontMap = {
|
|||
'CourierNewPS-BoldMT': 'Courier-Bold',
|
||||
'CourierNewPS-ItalicMT': 'Courier-Oblique',
|
||||
'CourierNewPSMT': 'Courier',
|
||||
'Helvetica': 'Helvetica',
|
||||
'Helvetica-Bold': 'Helvetica-Bold',
|
||||
'Helvetica-BoldItalic': 'Helvetica-BoldOblique',
|
||||
'Helvetica-BoldOblique': 'Helvetica-BoldOblique',
|
||||
'Helvetica-Italic': 'Helvetica-Oblique',
|
||||
'Helvetica-Oblique':'Helvetica-Oblique',
|
||||
'Symbol-Bold': 'Symbol',
|
||||
'Symbol-BoldItalic': 'Symbol',
|
||||
'Symbol-Italic': 'Symbol',
|
||||
|
@ -348,6 +351,10 @@ var stdFontMap = {
|
|||
* fonts without glyph data.
|
||||
*/
|
||||
var nonStdFontMap = {
|
||||
'CenturyGothic': 'Helvetica',
|
||||
'CenturyGothic-Bold': 'Helvetica-Bold',
|
||||
'CenturyGothic-BoldItalic': 'Helvetica-BoldOblique',
|
||||
'CenturyGothic-Italic': 'Helvetica-Oblique',
|
||||
'ComicSansMS': 'Comic Sans MS',
|
||||
'ComicSansMS-Bold': 'Comic Sans MS-Bold',
|
||||
'ComicSansMS-BoldItalic': 'Comic Sans MS-BoldItalic',
|
||||
|
@ -2455,7 +2462,8 @@ var Font = (function FontClosure() {
|
|||
// 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;
|
||||
var isStandardFont = !!stdFontMap[fontName] ||
|
||||
(nonStdFontMap[fontName] && !!stdFontMap[nonStdFontMap[fontName]]);
|
||||
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
|
||||
|
||||
this.bold = (fontName.search(/bold/gi) !== -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue