Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/core/xfa/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,25 @@ class Caption extends XFAObject {
return HTMLResult.EMPTY;
}

// For checkButton captions, add a non-breaking space at the beginning
// and replace all spaces with non-breaking spaces to prevent word wrapping
const parent = this[$getParent]();
if (
parent?.ui?.checkButton &&
typeof value === "object" &&
value.children
) {
for (const child of value.children) {
if (child.value && typeof child.value === "string") {
// Replace all regular spaces with non-breaking spaces
child.value = child.value.startsWith(" ")
? child.value.replaceAll(" ", "\u00A0")
: "\u00A0" + child.value.replaceAll(" ", "\u00A0");
child.value = child.value.replaceAll("/", "\u2044");
}
}
}

const savedReserve = this.reserve;
if (this.reserve <= 0) {
const { w, h } = this[$getExtra](availableSpace);
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
!issue8372.pdf
!issue9713.pdf
!xfa_filled_imm1344e.pdf
!xfa_bug1716806.pdf
!issue8424.pdf
!issue8480.pdf
!bug1650302_reduced.pdf
Expand Down
Binary file added test/pdfs/xfa_bug1716806.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,14 @@
"enableXfa": true,
"type": "eq"
},
{
"id": "xfa_bug1716806",
"file": "pdfs/xfa_bug1716806.pdf",
"md5": "ed78b522c661e744f780ab9b6d09fd8d",
"rounds": 1,
"enableXfa": true,
"type": "eq"
},
{
"id": "xfa_bug1716809",
"file": "pdfs/xfa_bug1716809.pdf",
Expand Down