diff --git a/src/core/fonts.js b/src/core/fonts.js index 6f8d60b319f10..890e4ca293070 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -1319,11 +1319,12 @@ var Font = (function FontClosure() { let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, ""); var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap(); - var isStandardFont = - !!stdFontMap[fontName] || - !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); - fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; + const isStandardFont = !!stdFontMap[fontName]; + const isMappedToStandardFont = !!( + nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]] + ); + fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; this.bold = fontName.search(/bold/gi) !== -1; this.italic = fontName.search(/oblique/gi) !== -1 || @@ -1334,9 +1335,9 @@ var Font = (function FontClosure() { this.black = name.search(/Black/g) !== -1; // if at least one width is present, remeasure all chars when exists - this.remeasure = Object.keys(this.widths).length > 0; + this.remeasure = !isStandardFont && Object.keys(this.widths).length > 0; if ( - isStandardFont && + (isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-") ) { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 6b7ae9e9a13d9..91665f7eb4bff 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -357,6 +357,7 @@ !issue6298.pdf !issue6889.pdf !bug1001080.pdf +!bug1671312_reduced.pdf !issue6108.pdf !issue6113.pdf !openoffice.pdf diff --git a/test/pdfs/bug1671312_reduced.pdf b/test/pdfs/bug1671312_reduced.pdf new file mode 100644 index 0000000000000..3242c303b4ab5 Binary files /dev/null and b/test/pdfs/bug1671312_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 19a428235dfea..bcbdbb8b3eb48 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2259,6 +2259,12 @@ "link": false, "type": "text" }, + { "id": "bug1671312_reduced", + "file": "pdfs/bug1671312_reduced.pdf", + "md5": "db13fe3f03a7d0bd0e248f5c2bcb2a5d", + "rounds": 1, + "type": "eq" + }, { "id": "issue7020", "file": "pdfs/issue7020.pdf", "md5": "93b464e21c649e64ae92eeafe99fc31b",