# letters and spacing in Arabic — bug in OpenType layout of LuaLaTeX

I perceive the following unwanted outcome:

Two issues:

1. In the first line, the last word on the right has a small gap between the second and the third letter from the right that is not supposed to be there.

2. In the second line, the word is entirely jumbled up.

I had issue #1 before in June 2013. I wrote to Khaled Hosny about it and he told me that it is a

bug in the OpenType layout engine currently used by LuaLaTeX.

The solution back in 2013 was to update luaotfload through issuing luaotfload-tool --update.

Today, that does not do the trick.

So what am I going to do? I am very surpised to suddenly see the old error again after 2,5 years. What happened?

The MWE, in case somebody is interested:

% !TEX TS-program = lualatexmk
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\arabicfont[  Script=Arabic,%
Numbers=Arabic,%
Scale=MatchLowercase%
]{Amiri}%
\newfontfamily\arabicfontz[ Script=Arabic,%
Numbers=Arabic,%
Scale=1.6%
]{Arabic Typesetting}%
\newcommand{\arabtext}[1]       % Arabic inside LTR
{\bgroup\textdir TRT\arabicfont #1\egroup}
\newcommand{\arabtextz}[1]      % Arabic inside LTR
{\bgroup\textdir TRT\arabicfontz #1\egroup}
\begin{document}
\noindent Font: Amiri => wrong: \arabtext{تعريف}\\
Font: Arabic Typesetting => very wrong: \arabtextz{تعريف}
\end{document}

• Does this happen with all fonts or just these two? Would you be interested in solutions with other fonts? – Alenanno Jan 2 '16 at 23:03
• Well, I recognised it with Amiri, which I decided to use. I checked with Arabic Typesetting just to see and was surprised by the even worse result. I checked with Arial and it was fine. So I am guessing that it depends to a degree on the font, but still something has recently gone bad. I did not recognise the error a few days ago. -- Anyway, I decided to use Amiri, but of course, tell me about other fonts! What do you use? – ClintEastwood Jan 2 '16 at 23:07
• I don't speak Arabic (yet), so none, but since you say Arial was fine, the fonts might have something to do with it? – Alenanno Jan 2 '16 at 23:11
• Scheherazade and Lateef produce good results. – Thérèse Jan 2 '16 at 23:46
• you might be interested in LuaTeX Harfbuzz shaper – michal.h21 Jan 3 '16 at 9:56