Commit 713d96199096680f9593e0d2cc53657eb8d27b46

Authored by Jay Berkenbilt
1 parent e3129ef4

Appearance streams: some floating point values were truncated

Bounding box X coordinates could be truncated, causing them to be off
by a fraction of a point. This was most likely not visible, but it was
still wrong.
libqpdf/QPDFFormFieldObjectHelper.cc
@@ -676,10 +676,10 @@ ValueSetter::writeAppearance() @@ -676,10 +676,10 @@ ValueSetter::writeAppearance()
676 if (highlight) 676 if (highlight)
677 { 677 {
678 write("q\n0.85 0.85 0.85 rg\n" + 678 write("q\n0.85 0.85 0.85 rg\n" +
679 - QUtil::int_to_string(bbox.llx) + " " + 679 + QUtil::double_to_string(bbox.llx) + " " +
680 QUtil::double_to_string(bbox.lly + dy - 680 QUtil::double_to_string(bbox.lly + dy -
681 (tfh * (highlight_idx + 1))) + " " + 681 (tfh * (highlight_idx + 1))) + " " +
682 - QUtil::int_to_string(bbox.urx - bbox.llx) + " " + 682 + QUtil::double_to_string(bbox.urx - bbox.llx) + " " +
683 QUtil::double_to_string(tfh) + 683 QUtil::double_to_string(tfh) +
684 " re f\nQ\n"); 684 " re f\nQ\n");
685 } 685 }
@@ -693,7 +693,7 @@ ValueSetter::writeAppearance() @@ -693,7 +693,7 @@ ValueSetter::writeAppearance()
693 // which doesn't seem really worth the effort. 693 // which doesn't seem really worth the effort.
694 if (i == 0) 694 if (i == 0)
695 { 695 {
696 - write(QUtil::int_to_string(bbox.llx + dx) + " " + 696 + write(QUtil::double_to_string(bbox.llx + dx) + " " +
697 QUtil::double_to_string(bbox.lly + dy) + " Td\n"); 697 QUtil::double_to_string(bbox.lly + dy) + " Td\n");
698 } 698 }
699 else 699 else
qpdf/qtest/qpdf/appearances-1.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-11.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-12.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-2.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-a-more.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-a-more2.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-a.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-b.pdf
No preview for this file type
qpdf/qtest/qpdf/appearances-quack.pdf
No preview for this file type