Skip to content

Commit 7dc343f

Browse files
committed
Bug 1716806 - Introduces a separator space between radio buttons/checkboxes and their labels/strings
1 parent 6a4a3b0 commit 7dc343f

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/core/xfa/template.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,25 @@ class Caption extends XFAObject {
12071207
return HTMLResult.EMPTY;
12081208
}
12091209

1210+
// For checkButton captions, add a non-breaking space at the beginning
1211+
// and replace all spaces with non-breaking spaces to prevent word wrapping
1212+
const parent = this[$getParent]();
1213+
if (
1214+
parent?.ui?.checkButton &&
1215+
typeof value === "object" &&
1216+
value.children
1217+
) {
1218+
for (const child of value.children) {
1219+
if (child.value && typeof child.value === "string") {
1220+
// Replace all regular spaces with non-breaking spaces
1221+
child.value = child.value.startsWith(" ")
1222+
? child.value.replaceAll(" ", "\u00A0")
1223+
: "\u00A0" + child.value.replaceAll(" ", "\u00A0");
1224+
child.value = child.value.replaceAll("/", "\u2044");
1225+
}
1226+
}
1227+
}
1228+
12101229
const savedReserve = this.reserve;
12111230
if (this.reserve <= 0) {
12121231
const { w, h } = this[$getExtra](availableSpace);

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
!issue8372.pdf
9494
!issue9713.pdf
9595
!xfa_filled_imm1344e.pdf
96+
!xfa_bug1716806.pdf
9697
!issue8424.pdf
9798
!issue8480.pdf
9899
!bug1650302_reduced.pdf

test/pdfs/xfa_bug1716806.pdf

204 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,14 @@
21282128
"enableXfa": true,
21292129
"type": "eq"
21302130
},
2131+
{
2132+
"id": "xfa_bug1716806",
2133+
"file": "pdfs/xfa_bug1716806.pdf",
2134+
"md5": "ed78b522c661e744f780ab9b6d09fd8d",
2135+
"rounds": 1,
2136+
"enableXfa": true,
2137+
"type": "eq"
2138+
},
21312139
{
21322140
"id": "xfa_bug1716809",
21332141
"file": "pdfs/xfa_bug1716809.pdf",

0 commit comments

Comments
 (0)