Skip to content

Commit 42dc206

Browse files
authored
Update acroform.js
1 parent 7e97f2d commit 42dc206

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugins/acroform.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362
var lastLength = 0;
363363

364364
var y = 0;
365-
if (fontSize == 0) {
365+
if (fontSize <= 0) {
366366
// In case, the Text doesn't fit at all
367367
fontSize = 12;
368368
text = "(...) Tj\n";
@@ -1383,7 +1383,7 @@
13831383
YesPushDown: function (formObject) {
13841384
var xobj = createFormXObject(formObject);
13851385
var stream = "";
1386-
var zapfDingbats = "F13"; //scope.internal.getFont("zapfdingbats").id || "F13";
1386+
var zapfDingbats = scope.internal.getFont("zapfdingbats", "normal").id;
13871387
// F13 is ZapfDingbats (Symbolic)
13881388
formObject.Q = 1; // set text-alignment as centered
13891389
var calcRes = calculateX(formObject, "3", "ZapfDingbats", 50);
@@ -1405,20 +1405,23 @@
14051405

14061406
YesNormal: function (formObject) {
14071407
var xobj = createFormXObject(formObject);
1408+
var zapfDingbats = scope.internal.getFont("zapfdingbats", "normal").id;
14081409
var stream = "";
14091410
formObject.Q = 1; // set text-alignment as centered
1410-
var calcRes = calculateX(formObject, "3", "ZapfDingbats", AcroFormAppearance.internal.getHeight(formObject) * 0.9);
1411+
var height = AcroFormAppearance.internal.getHeight(formObject);
1412+
var width = AcroFormAppearance.internal.getWidth(formObject);
1413+
var calcRes = calculateX(formObject, "3", "ZapfDingbats", height * 0.9);
14111414
stream += "1 g\n";
1412-
stream += "0 0 " + (AcroFormAppearance.internal.getWidth(formObject)).toFixed(2) + " " + (AcroFormAppearance.internal.getHeight(formObject)).toFixed(2) + " re\n";
1415+
stream += "0 0 " + width.toFixed(2) + " " + height.toFixed(2) + " re\n";
14131416
stream += "f\n";
14141417
stream += "q\n";
14151418
stream += "0 0 1 rg\n";
1416-
stream += "0 0 " + (AcroFormAppearance.internal.getWidth(formObject) - 1).toFixed(2) + " " + (AcroFormAppearance.internal.getHeight(formObject) - 1).toFixed(2) + " re\n";
1419+
stream += "0 0 " + (width - 1).toFixed(2) + " " + (height - 1).toFixed(2) + " re\n";
14171420
stream += "W\n";
14181421
stream += "n\n";
14191422
stream += "0 g\n";
14201423
stream += "BT\n";
1421-
stream += "/F13 " + calcRes.fontSize.toFixed(2) + " Tf 0 g\n";
1424+
stream += "/" + zapfDingbats + " " + calcRes.fontSize.toFixed(2) + " Tf 0 g\n";
14221425
stream += calcRes.text;
14231426
stream += "ET\n";
14241427
stream += "Q\n";

0 commit comments

Comments
 (0)