Merge pull request #21082 from calixteman/fix_comb_ltr

Fix how the text is printed/saved in a comb field when it's a RTL one
This commit is contained in:
Tim van der Meij 2026-04-12 14:16:42 +02:00 committed by GitHub
commit fbed36db00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2547,6 +2547,7 @@ class WidgetAnnotation extends Annotation {
descent,
lineHeight,
alignment,
bidi(lines[0]).dir === "rtl",
annotationStorage
);
}
@ -2911,6 +2912,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
descent,
lineHeight,
alignment,
isRTL,
annotationStorage
) {
const combWidth = width / this.data.maxLen;
@ -2922,6 +2924,9 @@ class TextWidgetAnnotation extends WidgetAnnotation {
for (const [start, end] of positions) {
buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
}
if (isRTL) {
buf.reverse();
}
const textWidth = combWidth * positions.length;
let hShift = hPadding;