Skip to content

Commit 8b5175a

Browse files
authored
Update arabic.js (#1807)
1 parent fc81d12 commit 8b5175a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugins/arabic.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@
236236
arabicSubst = Object.assign(arabicSubst, arabicorigsubst);
237237
return initialForm;
238238
}
239+
240+
var commonSubstition = function (character) {
241+
var replacementTable = {
242+
'(': ')',
243+
')': '('
244+
}
245+
return replacementTable[character] || character;
246+
}
239247

240248
var processArabic = jsPDFAPI.processArabic = function (text, reverse) {
241249
text = text || "";
@@ -258,7 +266,7 @@
258266
prevLetter = text[i - 1];
259267
nextLetter = text[i + 1];
260268
if (!isArabicLetter(currentLetter)) {
261-
result += currentLetter;
269+
result += reverse ? commonSubstition(currentLetter) : currentLetter;
262270
} else {
263271
if (
264272
(prevLetter !== undefined)

0 commit comments

Comments
 (0)