# Issue with RTL text in Polyglossia and Soul

I am trying to use the Soul package with Polyglossia to emphasize with letter spacing (this is a traditional typesetting technique in the language I'm using, and the typeface I'm using doesn't have italic or bold styles). I am not seeing any errors or warnings, but the emphasized text is shown LTR instead of RTL, and it looks like it's totally invisible if the last character is not punctuation (???)

Here is a MWE:

\documentclass{article}
\usepackage{soul}
\usepackage{fontspec, polyglossia}
\setmainlanguage{hebrew}
\newfontfamily{\hebrewfont}{Drugulin CLM}

\begin{document}
\so{שלום}

\so{שלום,}

\so{שלום} עליכם

\so{שלום,} עליכם

שלום עליכם
\end{document}


Here is what I see:

I am using XeLaTeX from TexLive 2018. Thanks for your time!

• This observation won’t solve your problem, but I’d use soulutf8 rather than soul. – Thérèse Aug 10 '18 at 1:33

What about a solution not using soul? You can use fontspec letter and word spacing features instead.

\documentclass{article}
\usepackage{fontspec, polyglossia}
\setmainlanguage{hebrew}
\newfontfamily{\hebrewfont}{SBL BibLit}[Script=Hebrew, Contextuals=Alternate, Ligatures=TeX]
\newfontfamily{\sohebrewfont}{SBL BibLit}[%
Script=Hebrew, Contextuals=Alternate, Ligatures=TeX, WordSpace=2, LetterSpace=25]
\newcommand{\so}[1]{{\sohebrewfont#1\kern 2.5pt}}
\begin{document}
\so{שלום}

\so{שלום,}

\so{שלום} עליכם

\so{שלום,} עליכם

שלום עליכם
\end{document}