Fix how the text is printed/saved in a comb field when it's a RTL one

This commit is contained in:
Calixte Denizet 2026-04-10 22:48:18 +02:00
parent 7cfcafbb4b
commit fa9b2ae32c

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;