Skip to content

Commit 1700910

Browse files
committed
Bug 1716806 - Introduces a separator space between radio buttons/checkboxes and their labels/strings
1 parent 3676ffd commit 1700910

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

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
@@ -2120,6 +2120,14 @@
21202120
"enableXfa": true,
21212121
"type": "eq"
21222122
},
2123+
{
2124+
"id": "xfa_bug1716806",
2125+
"file": "pdfs/xfa_bug1716806.pdf",
2126+
"md5": "ed78b522c661e744f780ab9b6d09fd8d",
2127+
"rounds": 1,
2128+
"enableXfa": true,
2129+
"type": "eq"
2130+
},
21232131
{
21242132
"id": "xfa_bug1716809",
21252133
"file": "pdfs/xfa_bug1716809.pdf",

0 commit comments

Comments
 (0)