1

When copying and pasting an Arabic text from a PDF file generated by context, the characters are not correctly joint.

Consider the following MWE:

\definefontfamily [font] [serif] [Amiri] [features=arabic]
\setupbodyfont [font]
\setcharacterstripping[1]
\setupdirections[bidi=global]
\setupalign[r2l]

\starttext
جملة عربية قصيرة
\stoptext

Copying and pasting the short sentence produce: ‫ة‬ ‫ر‬ ‫ي‬ ‫ص‬ ‫ق‬ ‫ة‬ ‫ي‬ ‫ب‬ ‫ر‬ ‫ع‬ ‫ة‬ ‫ل‬ ‫م‬ ‫ج‬. The letters are disjointed and have extra spaces between them. By looking at following string:

"\u202bة\u202c \u202bر\u202c \u202bي\u202c \u202bص\u202c \u202bق\u202c \u202bة\u202c \u202bي\u202c \u202bب\u202c \u202bر\u202c \u202bع\u202c ة\u202c \u202bل\u202c \u202bم\u202c \u202bج\u202c"

we can see the DIRECTIONAL FORMATTING chars. My question is how do I get proper PDF output which is copy-paste-able and searchable.

By looking at similar questions, I suppose that font encoding is not the problem here.

I am using context version: 2015.05.18 12:26, and luatex version beta-0.80.0 (TeX Live 2015).

closed as off-topic by Henri Menke, Jesse, CarLaTeX, Troy, Paul Gaborit Jul 2 '17 at 6:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Henri Menke, Jesse, CarLaTeX, Troy, Paul Gaborit
If this question can be reworded to fit the rules in the help center, please edit the question.

  • My results vary with the PDF viewer from which I copy and the application into which I copy. The output of pdftotext is perfect. – Thérèse Apr 9 '16 at 14:59
  • Thanks @Thérèse. I've just tried with Adobe Reader on Windows and Edge and the text is searchable and copy-able. Unfortunately, it does not work with evince, pdf.js and the chrome browser. – Eissa Apr 9 '16 at 17:28
  • This is clearly a viewer issue. Voting to close as off-topic. – Henri Menke Jul 2 '17 at 1:26