Fontspec/babel: Language ‘Arabic’ not available for font(fontspec) ‘ScheherazadeNew’ with script ‘Arabic’

arabicbabelfontsfontspec

For the Arabic font ScheherazadeNew, how to resolve this warning

Package fontspec Warning: Language 'Arabic' not available for font(fontspec) 'ScheherazadeNew' with
script 'Arabic'.

for the following document

\documentclass[12pt,a4paper]{article}

\usepackage{fontspec}
\setmainfont[Ligatures = {NoCommon, NoRare}]{Latin Modern Roman}
\newfontfamily\arabicfont{ScheherazadeNew}[ Script = Arabic, RawFeature={+anum}]

\usepackage[english, bidi = basic, layout = lists]{babel}
\babelprovide[import, onchar = ids fonts]{arabic}
\babelfont[arabic]{rm}[Scale = 1]{ScheherazadeNew}
\babelfont[arabic]{sf}[Scale = 1]{ScheherazadeNew}

\begin{document}
    
\end{document}

Additionally, is it redundant to use \newfontfamily\arabicfont and \babelfont[arabic]? Or does each one have different functions?

Best Answer

That MWE looks mostly correct for LuaLaTeX. You don.t need both \babelfont and \arabicfont: the first is for babel, which you’re using, and the second would be what you would use with polyglossia.

You do, however, want to add \babelfont{rm}{Latin Modern Roman} rather than \setmainfont{Latin Modern Roman}, to have babel correctly switch between your English and Arabic fonts. It’s also likely that you want to scale the two fonts to the same height, rather than Scale=1.0.

The warning about the font not containing the language Arabic is normally harmless. Fonts often don’t bother defining language tags that don’t change anything, like Greek for the Greek script or Hebrew for the Hebrew script. In this case, the font designer didn’t bother declaring an Arabic language for the Arabic script, and making the file slightly bigger, because that’s already the default for the Arabic script. You can suppress the message by loading a font with the Language=Default feature. (In the same place where you currently have Scale=1.0.)

So this might work for you:

\documentclass[12pt,a4paper]{article}
\tracinglostchars=3 % Make it an error if a glyph is missing from the current font
\usepackage[english, bidi = basic, layout = lists]{babel}
\usepackage{fontspec} % For \defaultfontfeatures

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }

\babelprovide[import, onchar = ids fonts]{arabic}

% Scheherazade New is available at:
% https://software.sil.org/scheherazade/
\babelfont{rm}
          [Ligatures={Common,Rare}, Scale=1.0, Language=Default]{Latin Modern Roman}
\babelfont[arabic]{rm}
          [Language=Default]{ScheherazadeNew}
\babelfont{sf}
          [Ligatures={Common,Rare}, Language=Default]{Latin Modern Sans}
\babelfont[arabic]{sf}
          [Language=Default]{ScheherazadeNew}

\begin{document}
Latin Modern Roman and
شهرزاد 
\end{document}

Scheherazade New sample

The main difference here is that it adds Scale=1.0 to the main font only, and scales all other fonts in the document to the same x-height as \defaultfontfeatures.

You’ll still get a warning about using the default tt (monospace) font family. If you need monospace Arabic, Arabic Latin Modern Fixed is a good match for Latin Modern.

You might also have a look at New Computer Modern Book, another clone of Computer Modern that’s slightly thicker than Latin Modern.

Related Question