[Tex/LaTex] Fake Semibold (bold without increasing the length of the text)

bold

The font I am using doesn't have a semibold weights.

I would like to fake a bold font that has a similar width to the regular font.

I tried using this approach from https://tex.stackexchange.com/a/23691/41036:

\newsavebox\CBox
\def\textBF#1{\sbox\CBox{#1}\resizebox{\wd\CBox}{\ht\CBox}{\textbf{#1}}}

It works very well for single words, however doesn't allow line-breaks etc.

How can I redefine this command to use it for longer expressions, most preferably like I would usually use \bfseries (e.g., by defining a new command like \bfsemiseries)?

Kindest regards,
Mil

Best Answer

You can't extend this command. But you can use a pdfliteral (assuming that you use pdflatex):

\documentclass[]{article}
\newcommand{\textBF}[1]{%
    \pdfliteral direct {2 Tr 0.3 w} %the second factor is the boldness
     #1%
    \pdfliteral direct {0 Tr 0 w}%
}

\usepackage{lipsum}

\begin{document}
some text 

\textBF{some text}

\textbf{some text}

\lipsum[1]

\textBF{\lipsum[1]}
\end{document}

enter image description here

Related Question