mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-05 22:55:49 +02:00
Fix how the text is printed/saved in a comb field when it's a RTL one
This commit is contained in:
parent
7cfcafbb4b
commit
fa9b2ae32c
@ -2547,6 +2547,7 @@ class WidgetAnnotation extends Annotation {
|
|||||||
descent,
|
descent,
|
||||||
lineHeight,
|
lineHeight,
|
||||||
alignment,
|
alignment,
|
||||||
|
bidi(lines[0]).dir === "rtl",
|
||||||
annotationStorage
|
annotationStorage
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2911,6 +2912,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||||||
descent,
|
descent,
|
||||||
lineHeight,
|
lineHeight,
|
||||||
alignment,
|
alignment,
|
||||||
|
isRTL,
|
||||||
annotationStorage
|
annotationStorage
|
||||||
) {
|
) {
|
||||||
const combWidth = width / this.data.maxLen;
|
const combWidth = width / this.data.maxLen;
|
||||||
@ -2922,6 +2924,9 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||||||
for (const [start, end] of positions) {
|
for (const [start, end] of positions) {
|
||||||
buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
|
buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
|
||||||
}
|
}
|
||||||
|
if (isRTL) {
|
||||||
|
buf.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
const textWidth = combWidth * positions.length;
|
const textWidth = combWidth * positions.length;
|
||||||
let hShift = hPadding;
|
let hShift = hPadding;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user