7

The following document prints in XeTeX the medial form of the arabic letter, thanks to the two ZWJ characters ("200D).

\documentclass{article}

\usepackage{fontspec}
\setmainfont[Script=Arabic]{Arabic Typesetting}

\begin{document}
\char"200Dي\char"200D
\end{document}

However, in LuaTeX I get:

ZWJ glyphs

The two glyphs for the ZWJ are actually in the font, but they shouldn't be shown. How can I hide them?

EDIT. For this particular case, the following works:

\documentclass{article}
\usepackage{luatextra}
\usepackage{fontspec}
\setmainfont[Script=Arabic]{Arabic Typesetting}

\begin{luacode*}
s = 'EU2/ArabicTypesetting(0)/m/n/10' 
local i = font.id(s)
local f = font.getfont(i)
f.characters[8205].index = 3
font.setfont(i, f)
\end{luacode*}

\begin{document}

\char"200Dي\char"200D

ي\char"200D

\char"200Dي

ي  

\end{document}

However, I'm still wondering if there is a more elegant and general approach based on a simple switch.

  • 1
    Are you sure that ZWNJ corresponds to slot x200D? In some of my own past work, I've used x200C for this invisible character. The slot x200D should be occupied by the ZWJ (zero width joiner) glyph. – Mico Aug 18 '15 at 13:06
  • I meant ZWJ, indeed. I edited the question. – Javier Bezos Aug 18 '15 at 13:15
  • Why not \char"FEF4 ? – Salim Bou Aug 19 '15 at 16:16
  • @salimbou Some fonts convert the presentation forms to the isolated ones. Anyway, the problem here is not getting the medial form, but the glyph shown by the ZWJ. – Javier Bezos Aug 19 '15 at 17:45
  • 2
    @JavierBezos Since fontspec for LuaTeX uses luaotfload, that ultimately uses the ConTeXt shaping engine, that depends on what ConTeXt does, so you'll have to convince Hans to use ZWJ correctly. – Arthur Reutenauer Aug 23 '15 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.