I can do the same with polyglossia both with xelatex and lualatex but
imagine that I am writing a document in Hindi and from time to time it
contains a single word in English, Russian, Urdu, Gujarati and it may
be loaded from another file. I just do not want to write \textenglish,
\textrussian, \texturdu, \textgujarati. With RTL inside LTR
ucharclasses works for single words, with two or more words it will be
wrong.

My point is with babel + LuaTeX you don’t need any macro
to switch the font, the text direction and the line breaking
rules, which is what you want. Things like \textenglish,
\textrussian, \texturdu, \textgujarati, etc., are not
necessary for a few words and short texts, even if the
script is RTL. The example in the babel manual is:

--------------------------------
\documentclass{book}

\usepackage[english, bidi=basic]{babel}

\babelprovide[onchar=ids fonts]{arabic}

\babelfont{rm}{Crimson} % Main font
\babelfont[*arabic]{rm}{FreeSerif} % Font for the Arabic script

\begin{document}

Most Arabic speakers consider the two varieties to be two registers
of one language, although the two registers can be referred to in
Arabic as فصحى العصر \textit{fuṣḥā l-ʻaṣr} (MSA) and
فصحى التراث \textit{fuṣḥā t-turāth} (CA).

\end{document}
--------------------------------

Javier

Reply via email to