How to use AutoFakeBold and AutoFakeItalic with fontspec?
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?
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}
\usepackage{harfload, fontspec}
\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)