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.

11
  • 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
    Commented Aug 18, 2015 at 13:06
  • I meant ZWJ, indeed. I edited the question. Commented Aug 18, 2015 at 13:15
  • Why not \char"FEF4 ?
    – Salim Bou
    Commented Aug 19, 2015 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. Commented Aug 19, 2015 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. Commented Aug 23, 2015 at 3:25

1 Answer 1

2

LuaTeX has HarfBuzz now. Rendering is OK.

zwj example

MWE

\documentclass{article}

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

\begin{document}
\begin{tabular}{rr}
\char"200Dي\char"200D & \textdir TRT  ي ييي \\
\char"200Dب\char"200D & \textdir TRT  ب ببب\\
\char"200Dش\char"200D & \textdir TRT ش ششش\\
\end{tabular}

\end{document}
3
  • Actually, your example is using the default renderer, not Harfbuzz 🙂. With Harfbuzz it fails! 😮 I didn’t remember this question. Thank you for updating it, and it may be convenient to close it, because things have changed a lot in the past five years. Commented May 16, 2021 at 15:22
  • @JavierBezos I don't get any issues when trying this with HarfBuzz, but I don't have the font used here. Could you write a bug report for that and/or send me a MNWE (preferably with open fonts if possible)? Commented May 16, 2021 at 15:56
  • @MarcelKrüger On TeX Live 2021 for Windows, it succeeds with either Renderer=Node or Renderer=HarfBuzz.
    – Davislor
    Commented May 16, 2021 at 16:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .