1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +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:
Calixte Denizet 2021-06-20 14:03:59 +02:00
parent 248efb16a7
commit 7cdbc98716
13 changed files with 221 additions and 57 deletions

View file

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9227656

View file

@ -938,6 +938,14 @@
"enableXfa": true,
"type": "eq"
},
{ "id": "xfa_bug1716980",
"file": "pdfs/xfa_bug1716980.pdf",
"md5": "3d7598b9548d78f209d013c485162e9a",
"link": true,
"rounds": 1,
"enableXfa": true,
"type": "eq"
},
{ "id": "xfa_bug1716809",
"file": "pdfs/xfa_bug1716809.pdf",
"md5": "7192f9e27e8b84776d107f57cbe353d5",

View file

@ -73,6 +73,7 @@ describe("XFAFactory", function () {
</xdp:xdp>
`;
const factory = new XFAFactory({ "xdp:xdp": xml });
factory.setFonts([]);
expect(factory.numberPages).toEqual(2);
@ -116,7 +117,7 @@ describe("XFAFactory", function () {
]);
expect(draw.attributes.style).toEqual({
color: "#0c1722",
fontFamily: '"FooBar","FooBar-PdfJS-XFA"',
fontFamily: '"FooBar"',
fontSize: "6.93px",
margin: "1px 4px 2px 3px",
verticalAlign: "2px",