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;