Closed tifv closed 2 months ago
Should be fixed.
I'm reopening as it seems like we have a regression in master. The example provided by the OP no longer produce a correct output.
Was this bug really fixed? If I reverse the rolls of russian and english in the example
\documentclass[10pt]{article}
\usepackage[no-math]{fontspec}
\usepackage{xcolor}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}[Color=blue]
\setmonofont{CMU Typewriter Text}[Color=red]
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\begin{document}
\sffamily
\begin{english}
Should be sans.
\ttfamily
Should be monospaced.
\begin{russian}
Sans, but should be monospaced?
\end{russian}
\end{english}
\end{document}
I get the same problem (also tested with TL 2022). In 8ef31ad I also stored font families in Latin fonts, which fixed it.
The problem is fixed, AFAICS
will produce You can see that inner language switch resets the font back to sans. This is unexpected, as I intended to switch language, not the font.
Further tests show that the outer language switch somehow “memorizes” the font family that was used at the moment it was enabled, and any inner language switch will set it irregardless of subsequent font family changes. (Tested with TeXLive 2021. Using English inside
russian
environment is irrelevant, it will work the same with a Russian text. Probably related to #251.)