\babelfont doesn’t work

babelcyrillicfontslanguages

I am trying to typeset a document with multiple languages, and I need to use a different font for one of the languages because of the lack of boldface for said language in the global font.

I tried to do the following

\documentclass{article}

\usepackage[T2A,T1]{fontenc} 
\usepackage[utf8]{inputenc}

\usepackage[serbianc,french,english]{babel}
\babelfont{rm}{Linguistics Pro}
\babelfont[Language=serbian]{tt}{FreeSerif}

\begin{document}
\Serbianc{Hello, \texttt\Huge{Поздрав}!}
\end{document}

However, i get an "undefined control sequence" error.
I have tried to run the example from the babel documentation, Section 1.14, and I still received the same error.
I have no idea what is going on.

Is there a way to either load \babelfont, or to do the thing that I need in any other way?

Best Answer

As I had the same issue recently where I was unable to change compiler from pdfLaTeX I did the following for Greek text:

\usepackage[greek,english]{babel}
\usepackage[LGR,T1]{fontenc}

% This is my main font
\usepackage{mlmodern}

% Switch back to Computer Modern for Greek
\usepackage{substitutefont}
\substitutefont{LGR}{\rmdefault}{cmr}

For Serbian you would need to find a T2A compatible font that would let you make it bold and not an OpenType as this won't work with pdfLaTeX.

EDIT

The following MWE produces what you want I think:

\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[serbianc,english]{babel}

\usepackage{substitutefont}
\substitutefont{T2A}{\ttdefault}{iwona}

\begin{document}
\Serbianc{Hello, \texttt{\Huge\textbf{Поздрав!}}}
\end{document}

enter image description here

The key lies in using a font supporting T2A encoding (here iwona is used), have a look at this:

What fonts are compatible with T2A (Cyrillic) encoding?