2

I'm not that hot with fontspec and friends, so took most from this answer about Nepali verbatim:

How to write Nepali and English on the same page in Overleaf

Here's my slightly edited code:

\documentclass{report}
\tracinglostchars=3 % Error if language detection fails!
\usepackage[bidi=basic, layout=sectioning, nil]{babel}
\usepackage{microtype}
\usepackage{graphicx}

\emergencystretch=3em % Compensate for lack of hyphenation.

\babelprovide[import=en, main, onchar=fonts ids]{english}
\babelprovide[import=ne, onchar=fonts ids]{nepali}

\usepackage{fontspec}
\defaultfontfeatures{ Scale = MatchUppercase, Ligatures=TeX }
\babelfont{rm}[Language=Default]{Noto Sans}
\babelfont[nepali]{rm}[Language=Default]{Noto Sans Devanagari}

\begin{document}

\includegraphics[width=2cm]{word}

\Large

\foreignlanguage{nepali}{फ्राई}
\end{document}

And here is word.png, which should render as "फ्राई":

enter image description here

I notice in a cruel twist that they look similar here, but they certainly do not when I run this.

2
  • 3
    you need the harfbuzz renderer: \babelfont[nepali]{rm}[Language=Default,Renderer=Harfbuzz]{Noto Sans Devanagari} Apr 29 at 13:13
  • Thank you, works like a charm :D Apr 29 at 21:56

1 Answer 1

4

As Ulrike Fischer answered in the comments, you need the Harfbuzz renderer in LuaLaTeX with Noto Sans Devanagari. Add it as an option when loading Noto Sans Devanagari.

\documentclass{report}
\tracinglostchars=3 % Error if language detection fails!
\usepackage[bidi=basic, layout=sectioning, nil]{babel}
\usepackage{microtype}
\usepackage{graphicx}

\emergencystretch=3em % Compensate for lack of hyphenation.

\babelprovide[import=en, main, onchar=fonts ids]{english}
\babelprovide[import=ne, onchar=fonts ids]{nepali}

\usepackage{fontspec}
\defaultfontfeatures{ Scale = MatchUppercase, Ligatures=TeX }
\babelfont{rm}
          [Language=Default]{Noto Sans}
\babelfont[nepali]{rm}
          [Language=Default, Renderer=HarfBuzz]{Noto Sans Devanagari}

\begin{document}

% \includegraphics[width=2cm]{word}

\Large

\foreignlanguage{nepali}{फ्राई}
\end{document}

Noto Sans Devanagari sample

I’ve edited the fix into my previous answer that you linked. Thank you for finding this bug.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.