9

Please see this MWE given below which tries to produce normal, bold and italic text in Bengali.

\documentclass{article}

% For a bilingual document
\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage{english}
\defaultfontfeatures{Ligatures=TeX}

% Times New Roman used for English
\setmainfont[Mapping=tex-text, Ligatures=TeX]{Times New Roman}

% Bengali
\setotherlanguage[numerals=Devanagari]{bengali}
\newfontfamily\bengalifont[Script=Bengali]{SolaimanLipi}
\newfontfamily\bengalifontbf[Script=Bengali]{SolaimanLipi}
\newfontfamily\bengalifonttt[Script=Bengali]{SolaimanLipi}
\newfontfamily\bengalifontsf[Script=Bengali]{SolaimanLipi}

\begin{document}

\begin{bengali}
  বাংলা ভাষা

  \textbf{বাংলা ভাষা}

  \textit{বাংলা ভাষা}

\end{bengali}

\end{document}

When compiled, the second and third text appear in normal font, with the following log message:

LaTeX Font Warning: Font shape `EU1/SolaimanLipi(0)/bx/n' undefined
(Font)              using `EU1/SolaimanLipi(0)/m/n' instead on input line 24.

LaTeX Font Warning: Font shape EU1/SolaimanLipi(0)/m/it' undefined (Font) usingEU1/SolaimanLipi(0)/m/n' instead on input line 26.

However, the same font (SolaimanLipi) can be used in other applications, e.g. LibreOffice to get the same effect.

enter image description here

What is it I could be doing wrong?

EDIT

LibreOffice is using the same font

enter image description here

There is no other SolaimanLipi font in my machine

Command

sudo find / -name SolaimanLipi* -print

gives,

/home/masroor/.local/share/fonts/SolaimanLipi_20-04-07.ttf

Masroor
  • 17,842
  • I downloaded the font from the link you provided and opened it in FontBook (a MacOS app). According to FontBook, the only weight provided is 'normal' -- no 'bold'. Is there maybe another version of the font somewhere that provides both normal and bold weights? – Mico Mar 17 '17 at 05:47
  • @Mico There is no other SolaimanLipi font in my machine. Please see my edit. But your observation regarding the font file is correct, the font viewer in Linux says that it has only normal font. However, the same font can be used in web browsers to view normal as well as bold and italic texts. – Masroor Mar 17 '17 at 06:19
  • 1
    Sometimes applications like LO fake the bold effect for fonts that do not have this weight. Maybe you want to have a look at the according fontspec feature. – TeXnician Mar 17 '17 at 06:52

1 Answers1

16

You could work with the faking of bold fonts as many WYSIWYG editors are using this too.

In the following code I've added the AutoFakeBold=4.0 font option. Just adjust the number to adjust the weight (the higher the bolder).

Edit: If you also want to fake italics/slanted font try using AutoFakeSlant=0.4 where the number also indicates the strength of the slant.

bengali faked bold and slanted

\documentclass{article}

% For a bilingual document
\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage{english}
\defaultfontfeatures{Ligatures=TeX}

% Times New Roman used for English
\setmainfont[Mapping=tex-text, Ligatures=TeX]{Times New Roman}

% Bengali
\setotherlanguage[numerals=Devanagari]{bengali}
\newfontfamily\bengalifont[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi.ttf}
\newfontfamily\bengalifontbf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi.ttf}
\newfontfamily\bengalifonttt[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi.ttf}
\newfontfamily\bengalifontsf[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi.ttf}

\begin{document}

\begin{bengali}
  বাংলা ভাষা

  \textbf{বাংলা ভাষা}

  \textit{বাংলা ভাষা}

\end{bengali}

\end{document}
TeXnician
  • 33,589
  • A nice solution. – Masroor Mar 17 '17 at 07:48
  • 1
    @Masroor By far not, because it still only fakes the effects of bold and italic, but it's working (and without right font there's no real alternative). – TeXnician Mar 17 '17 at 07:51
  • Is there a way we can fake tt font as well? I am referring to the line, \newfontfamily\bengalifonttt[Script=Bengali,AutoFakeBold=4.0,AutoFakeSlant=0.4]{SolaimanLipi.ttf}, which I think does not have any effect at all except using normal font for tt. – Masroor Mar 18 '17 at 01:24
  • 1
    @Masroor Unfortunately not. And googling around I found no way to make a proportional font mono-spaced. That would be a great new question. – TeXnician Mar 18 '17 at 07:00
  • @TeXnician I tried AutoFakeBold with another font. I get the Bold effect. But the weight of the font remains unchanged when I change the number. What could be the reason. I tried with Tiro Kannada font – vrgovinda Aug 15 '22 at 14:00
  • @VrajarajaGovindaDas I can't say without seeing the code. Best make a MWE and post a new question. – TeXnician Aug 16 '22 at 14:16