4

If I use \setmainfont directive in my document, this is what I get instead of british glyphs!

enter image description here

What's the reason of this problem and how to fix it?

\documentclass{article}
\usepackage{harfload, fontspec}
\setmainfont{Noto Sans Bengali}[RawFeature={mode=harf}]

\parindent 0pt
\begin{document}
    বাংলা \textbf{বাংলা}\\
    English
\end{document}
Ulrike Fischer
  • 327,261
  • 5
    Noto Sans Bengali does not contain the Latin alphabet. – Thérèse Jun 20 '19 at 03:11
  • 1
    @Thérèse, you're right! Post it as an answer. –  Jun 20 '19 at 03:45
  • 1
    but your question is presumably wrong, as it implies that this works in Windows and not in some other operating system. – David Carlisle Jun 20 '19 at 07:03
  • 3
    I can’t answer today — no internet connection except on my phone. But the question title should be edited: KDE has nothing to do with the problem (and the glyphs are Latin). – Thérèse Jun 20 '19 at 12:41
  • @DavidCarlisle, I didn't know that I was wrong until I installed Kalpurush.ttf on my system! –  Jun 20 '19 at 14:58
  • 2
    I mean you stated that "On windows 10, we don't have this problem! " but you must have had that problem on windows as well. How is Kalpurush.ttf related? The question is about Noto Sans. – David Carlisle Jun 20 '19 at 15:04
  • @DavidCarlisle, ok, edited. –  Jun 20 '19 at 16:16
  • Judging by the multi-linguistic setup, you may want to start using polyglossia. – Ruixi Zhang Jun 20 '19 at 16:26
  • 1
    @RuixiZhang, I don't need polyglossia in luatex + harftex for multilingual document. I used Arabic, Bangla and English in the same document with fontspec and arabluatex. In this case, problem was in font as mentioned by Thérèse. If I use Kalpurush or Sutonny, I've no problem with English. –  Jun 20 '19 at 17:36

1 Answers1

9

Noto Sans Bengali does not contain glyphs for the Latin alphabet.

You may have thought it did if working in a word processor on Windows, because such programs may silently substitute other fonts when glyphs are missing. harftex gives you more control and, in consequence, requires you to say exactly what you want.

Here’s one way to do that:

\documentclass{article}
\usepackage{harfload,fontspec}
\setmainfont{Noto Sans Bengali}[RawFeature={mode=harf}]
\newfontfamily\british{Noto Sans}[Script=Latin]
\parindent 0pt
\begin{document}
বাংলা \textbf{বাংলা}\\
\british English
\end{document}

output

UPDATE

As of November 2019, you can install luahbtex and replace the lines

\usepackage{harfload,fontspec}
\setmainfont{Noto Sans Bengali}[RawFeature={mode=harf}]

with these:

\usepackage{fontspec}
\setmainfont{Noto Sans Bengali}[Renderer=Harfbuzz,Script=Bengali]

See Ulrike Fischer’s explanation for details.

Thérèse
  • 12,679