1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Fallback font for buttons must be ZapfDingbats.

Fix bug https://bugzilla.mozilla.org/show_bug.cgi?id=1669099.
This commit is contained in:
Calixte Denizet 2020-10-21 17:21:33 +02:00
parent 1eaf9c961b
commit 37c86b2daa
6 changed files with 109 additions and 5 deletions

View file

@ -374,6 +374,7 @@
!issue12418_reduced.pdf
!annotation-freetext.pdf
!annotation-line.pdf
!bug1669099.pdf
!annotation-square-circle.pdf
!annotation-stamp.pdf
!annotation-fileattachment.pdf

BIN
test/pdfs/bug1669099.pdf Normal file

Binary file not shown.

View file

@ -4153,6 +4153,20 @@
"rounds": 1,
"type": "eq"
},
{ "id": "bug1669099",
"file": "pdfs/bug1669099.pdf",
"md5": "34421549d58e2b6eeddc674759381f7d",
"rounds": 1,
"type": "eq",
"print": true,
"annotationStorage": {
"29R": true,
"33R": true,
"37R": true,
"65R": true,
"69R": true
}
},
{ "id": "issue1171.pdf",
"file": "pdfs/issue1171.pdf",
"md5": "2a6188a42a5874c7874b88eebd4acaf0",

View file

@ -2053,6 +2053,65 @@ describe("annotation", function () {
}, done.fail);
});
it("should render checkbox with fallback font for printing", function (done) {
const appearanceStatesDict = new Dict();
const normalAppearanceDict = new Dict();
const checkedAppearanceDict = new Dict();
const uncheckedAppearanceDict = new Dict();
const checkedStream = new StringStream("/ 12 Tf (4) Tj");
checkedStream.dict = checkedAppearanceDict;
const uncheckedStream = new StringStream("");
uncheckedStream.dict = uncheckedAppearanceDict;
checkedAppearanceDict.set("BBox", [0, 0, 8, 8]);
checkedAppearanceDict.set("FormType", 1);
checkedAppearanceDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
normalAppearanceDict.set("Checked", checkedStream);
normalAppearanceDict.set("Off", uncheckedStream);
appearanceStatesDict.set("N", normalAppearanceDict);
buttonWidgetDict.set("AP", appearanceStatesDict);
const buttonWidgetRef = Ref.get(124, 0);
const xref = new XRefMock([
{ ref: buttonWidgetRef, data: buttonWidgetDict },
]);
const task = new WorkerTask("test print");
partialEvaluator.options = { ignoreErrors: true };
AnnotationFactory.create(
xref,
buttonWidgetRef,
pdfManagerMock,
idFactoryMock
)
.then(annotation => {
const annotationStorage = {};
annotationStorage[annotation.data.id] = true;
return annotation.getOperatorList(
partialEvaluator,
task,
false,
annotationStorage
);
})
.then(opList => {
expect(opList.argsArray.length).toEqual(5);
expect(opList.fnArray).toEqual([
OPS.beginAnnotation,
OPS.dependency,
OPS.setFont,
OPS.showText,
OPS.endAnnotation,
]);
expect(opList.argsArray[3][0][0].fontChar).toEqual("✔");
done();
})
.catch(done.fail);
});
it("should render checkboxes for printing", function (done) {
const appearanceStatesDict = new Dict();
const normalAppearanceDict = new Dict();