# How to use AutoFakeBold and AutoFakeItalic with fontspec?

The font, Kalpurush, doesn't have any Bold, Italic, BoldItalic etc. features in it.

\documentclass{article}
\setmainfont{Kalpurush}[RawFeature={mode=harf}]

\parindent 0pt
\begin{document}
বাংলা  \textbf{বাংলা} \textit{বাংলা} \\
English \textbf{English} \textit{English}
\end{document}


Setting it as mainfont removes the Bold, Italic, BoldItalic features from English as well. How can I make it Bold, Italic, BoldItalic? Does AutoFake wok with Luatex/Harftex?

• From the fontspec manual: »The FakeBold and AutoFakeBold features are only available with the XeTeX engine and will be ignored in LuaTeX.« – Henri Menke Jun 21 '19 at 4:24
• I don't know if harf mode can embolden like you can do with xelatex. You could ask here github.com/khaledhosny/harf/issues. – Ulrike Fischer Jun 21 '19 at 6:50
• @UlrikeFischer I'm pretty sure it can't. So it would have to be a feature request. – Marcel Krüger Jun 21 '19 at 6:58
• @MarcelKrüger actually I don't think that this a harfbuzz "feature". I looked in the pdf from xelatex and it contains a literal Tf 2 Tr 0.300003 w which makes the font bolder. I asked once if the fontloader can do it too, but never got a real answer: mail-archive.com/ntg-context@ntg.nl/msg86408.html. – Ulrike Fischer Jun 21 '19 at 7:07
• @UlrikeFischer I added a branch embolden to my repo which implements a currently untested, but (hopefully) XeTeX compatible feature embolden to the fontloader. – Marcel Krüger Jun 21 '19 at 8:12

Adding the font option AutoFakeBold and AutoFakeBold should enable emboldened and slanted fonts with fonts that do not have bold and italic style.

This works with XeTeX:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Kalpurush}
[
AutoFakeBold,
AutoFakeSlant,
]

\parindent 0pt
\begin{document}
বাংলা  \textbf{বাংলা} \textit{বাংলা} \\
English \textbf{English} \textit{English}
\end{document}


With LuaTeX and HarfTeX the AutoFakeBold option will cause a warning and will be ignored by fontspec (until this pull request is merged). A workaround is to do it manually BoldFeatures option:

\documentclass{article}
\setmainfont{Kalpurush}
[
AutoFakeBold,
AutoFakeSlant,
BoldFeatures={RawFeature={embolden=1.5}},
RawFeature={mode=harf},
]

\parindent 0pt
\begin{document}
বাংলা  \textbf{বাংলা} \textit{বাংলা} \\
English \textbf{English} \textit{English}
\end{document}


(this requires the latest harfload package from its GitHub repository)

With luahblatex (latex based on the engine luahbtex), luaotfload version 3.11 (uploaded 10.11.) (the version is needed so that Script=Bengali works correctly) and a current fontspec it works fine:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Kalpurush}[Renderer=Harfbuzz,Script=Bengali,AutoFakeSlant,AutoFakeBold]

\parindent 0pt
\begin{document}
বাংলা  \textbf{বাংলা} \textit{বাংলা} \\
English \textbf{English} \textit{English}
\end{document}


How to install the luahbtex engine is described here: How to install HarfTeX on TeXLive?