mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Fix the computation of unitsPerEm when the fontMatrix has some negative coefficients
It's a follow-up of #18253.
This commit is contained in:
parent
6784124a74
commit
42bb2b0737
4 changed files with 10 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue