Soul package and Cyrillic with xelatex

cyrillicfontssoulxetex

How to handle Cyrillic ymbols with soul package?

\documentclass[a4paper,10pt]{book}
\usepackage{polyglossia}
    \defaultfontfeatures{Ligatures={TeX}}
    \setmainfont{Liberation Serif}
    \setmonofont{Liberation Mono}
    \setmainlanguage{ukrainian}
\usepackage{soulutf8}
\begin{document}
    \mainmatter
    Короткий зміст\par
    Brief content\par
    \so{Короткий зміст}\par
    \so{Brief content}
\end{document}

Compile with

xelatex test.tex

enter image description here

I assume that this is caused by the absence of Cyrillic characters in the internal font used by soul package. It is possible to set this font with \font\SOUL@tt= but I don't know how I can use a font with this command.

I added \tracinglostchars=2 and saw this:

Missing character: There is no К in font ectt1000!
Missing character: There is no о in font ectt1000!
...
Missing character: There is no с in font ectt1000!
Missing character: There is no т in font ectt1000!

Best Answer

You can locally add the LetterSpace feature.

\documentclass[a4paper,10pt]{book}
\usepackage{polyglossia}

%\defaultfontfeatures{Ligatures={TeX}} % not needed
\setmainfont{Liberation Serif}
\setmonofont{Liberation Mono}
\setmainlanguage{ukrainian}

\NewDocumentCommand{\so}{m}{%
  {\addfontfeatures{LetterSpace=10,Ligatures=NoCommon}#1}%
}

\begin{document}

\mainmatter

Короткий зміст

Brief content ffi ffl

\so{Короткий зміст}

\so{Brief content ffi ffl}

Короткий зміст

Brief content ffi ffl

\end{document}

enter image description here

The Ligatures=NoCommon is necessary with fonts having ligatures, as the following example with Libertinus Serif instead of Liberation shows:

enter image description here

Beware that stealing sheep is not considered good practice. 😉

I know that it's common with Cyrillic to letter space also lower case for emphasis, but letter spacing Latin letters is not considered good typography.

Related Question