diff --git a/src/core/fonts.js b/src/core/fonts.js index 7959f8ffc118d..52994267da462 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -799,7 +799,7 @@ function createOS2Table(properties, charstrings, override) { const unitsPerEm = override.unitsPerEm || (properties.fontMatrix - ? 1 / Math.max(...properties.fontMatrix.slice(0, 4)) + ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000); // if the font units differ to the PDF glyph space units @@ -3199,7 +3199,7 @@ class Font { } const unitsPerEm = properties.fontMatrix - ? 1 / Math.max(...properties.fontMatrix.slice(0, 4)) + ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000; const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F"); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index a0991c7193413..2c6cad45937e6 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -650,3 +650,4 @@ !issue17998.pdf !pdfjs_wikipedia.pdf !bug1539074.pdf +!bug1539074.1.pdf diff --git a/test/pdfs/bug1539074.1.pdf b/test/pdfs/bug1539074.1.pdf new file mode 100755 index 0000000000000..d99f1de37db05 Binary files /dev/null and b/test/pdfs/bug1539074.1.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 0882c41858296..87e2df8b487e6 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10098,6 +10098,13 @@ "rounds": 1, "type": "eq" }, + { + "id": "bug1539074_1", + "file": "pdfs/bug1539074.1.pdf", + "md5": "d15c49142fda433323d3d35f2762cd33", + "rounds": 1, + "type": "eq" + }, { "id": "bug1903731", "file": "pdfs/bug1903731.pdf",