From fa9b2ae32c8ad81ee797505ccd5fedef41d3cca3 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 10 Apr 2026 22:48:18 +0200 Subject: [PATCH] Fix how the text is printed/saved in a comb field when it's a RTL one --- src/core/annotation.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/annotation.js b/src/core/annotation.js index 08b613250..1bb949afe 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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;