1

As a followup of my question for Urdu I have now the question for the other languages like Pashto and Persian. I follow the sample and the doc and have the following MWE:

\documentclass{article}
\usepackage{fontspec}
\usepackage[shorthands=off,bidi=basic,english, ngerman]{babel}
\babelprovide[import=ur,mapdigits]{urdu}
\babelfont[urdu]{rm}[Renderer=HarfBuzz]{Amiri}
\babelprovide[import=ps]{pashto}
\babelfont[pashto]{rm}[Renderer=HarfBuzz]{Amiri}
\babelprovide[import=fa]{persian}
\babelfont[persian]{rm}[Renderer=HarfBuzz]{Amiri}

\begin{document} My urdu test \selectlanguage{urdu}

یہ ایک جملہ ہے

{\selectlanguage{pashto}رآورد نفوس کشورد هېواد د و ګړو اټکل1398 [}Estimated Population of Afghanistan 1398 (2019/2020)],
{\selectlanguage{persian} رآورد نفوس کشورد هېواد د و ګړو اټکل1398 [}Estimated Population of Afghanistan 2020],

\end{document}

I'm using

This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/TeX Live for SUSE Linux)  (format=lualatex 2020.11.26) 

and get the following warnings:

Language 'Pashto' not available for font(fontspec) 'Amiri-Regular' with script 'Arabic'.
Language 'Persian' not available for font(fontspec) 'Amiri-Regular' with script 'Arabic'.

Since this works fine for Urdu I have no clue how to avoid these warnings? Or how to make a better setup? Any hints?

LeO
  • 1,451
  • see https://github.com/wspr/fontspec/issues/421 – Ulrike Fischer Nov 30 '20 at 08:05
  • You’ve edited the question after people answered, which is best to avoid if possible. As edited, you should provide a font for English/German. I would recommend Libertinus Serif or Linux Libertine as a good match for Amiri. – Davislor Nov 30 '20 at 08:44
  • Yeah, OK, I'll take care the next time. Wasn't made to screw up things and I acknowledge your point. – LeO Nov 30 '20 at 08:59

1 Answers1

2

The warning is harmless, but you can suppress it by loading the font with Language=Default, e.g.

\documentclass{article}
\usepackage[bidi=basic, nil]{babel}
\usepackage{fontspec}

\defaultfontfeatures{ Renderer=HarfBuzz, Scale=MatchUppercase, Ligatures=TeX }

\babelfont{rm} [Ligatures=Common, Scale=1.0]{Libertinus Serif}
\babelprovide[import=ur, mapdigits, main]{urdu} \babelfont[urdu]{rm} {Amiri} \babelprovide[import=ps]{pashto} \babelfont[pashto]{rm} [Language=Default]{Amiri} \babelprovide[import=fa]{persian} \babelfont[persian]{rm} [Language=Default]{Amiri}

\babeltags{pashto=pashto} \babeltags{persian=persian} \babeltags{urdu=urdu}

It might be worthwhile declaring English for the LTR text, such as “Population of Afghanistan.” The \babeltags declarations let you write \textpashto{...} instead of {\selectlanguage{pashto}...}.

Davislor
  • 44,045
  • Thx to have an idea how to get rid of the warnings :-) With your answer you add defaultfontfeatures and the Renderer. Is this 'required' since this would apply to English texts as well. Thx as well for the explanation of babeltags since I would have asked for this as well :-) – LeO Nov 30 '20 at 08:36
  • @LeO The document does not currently support English. If you did, selecting the HarfBuzz renderer for it is benign. (XeTeX uses HarfBuzz as well.) You could, if you wanted, override it with Renderer=Node. – Davislor Nov 30 '20 at 08:38
  • I've updated my sample with the babel definition I finally use. Thx for the explanation but I think I stick to the approach and define the Renderer in the font. Unless there is a specific reason to not do so. Anyway thx for the help. – LeO Nov 30 '20 at 08:42