mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
XFA - Match font family correctly
- partial fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1716980; - some pdf can contain an invalid font family (e.g. 'Windings 3') so in this case remove the space; - the font family in typeface attribute doesn't always match the one defined in the FontDescriptor dictionary.
This commit is contained in:
parent
248efb16a7
commit
7cdbc98716
13 changed files with 221 additions and 57 deletions
|
@ -926,7 +926,9 @@ class PDFDocument {
|
|||
if (!(descriptor instanceof Dict)) {
|
||||
continue;
|
||||
}
|
||||
const fontFamily = descriptor.get("FontFamily");
|
||||
let fontFamily = descriptor.get("FontFamily");
|
||||
// For example, "Wingdings 3" is not a valid font name in the css specs.
|
||||
fontFamily = fontFamily.replace(/[ ]+([0-9])/g, "$1");
|
||||
const fontWeight = descriptor.get("FontWeight");
|
||||
|
||||
// Angle is expressed in degrees counterclockwise in PDF
|
||||
|
@ -956,6 +958,7 @@ class PDFDocument {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
this.xfaFactory.setFonts(pdfFonts);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue