With nested language switches, any inner switch sets the font family that outer switch had “seen”, not the current font

This issue has been created since 2021-10-25.
\documentclass[10pt]{article}

\usepackage[no-math]{fontspec}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{russian}

\begin{document}

\sffamily
\begin{russian}
Should be sans.
\ttfamily
Should be monospaced.
\begin{english}
Sans, but should be monospaced?
\end{english}
\end{russian}

\end{document}

will produce
image
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.)

jspitz wrote this answer on 2021-10-25

#251 is not the culprit here.

jspitz wrote this answer on 2021-10-25

Should be fixed.

More Details About Repo
Owner Name reutenauer
Repo Name polyglossia
Full Name reutenauer/polyglossia
Language TeX
Created Date 2011-10-04
Updated Date 2022-08-05
Star Count 157
Watcher Count 17
Fork Count 48
Issue Count 21

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Not working with sample northwind db from microsoft in sql express 3 2021-03-13 2022-09-16
Getting issue on save file 1 2022-09-10 2022-09-19
Cannot automatically sort tailwindcss classes 3 2022-09-09 2022-09-19
Replace uwsgi with a ASGI replacement 2 2022-03-31 2022-08-10
BE_Version reports 4.2.2 for latest release (4.2.3) 2 2022-01-26 2022-09-16
No ChallengeStatusReceiver for transaction id 0 2021-04-21 2022-09-06
Floating window renderer masks cmdline messages 4 2021-04-06 2022-09-13
Model document symbols 4 2018-11-04 2022-07-28
LSP Diagnostics use the wrong groups 1 2021-04-12 2022-09-22
Empty values in PAPI placeholders for TownyChat 2 2021-03-29 2022-09-15
No Search Results for Artist using Headphones Mirror 4 2021-10-07 2022-09-09
[feature request][river-layout] Tag parameter for user_command event 2 2021-08-05 2022-09-28
Publish Dockerfile used for lsquic-qir 0 2022-08-28 2022-09-18
Do you have plan to support Webtransport? 1 2022-08-10 2022-09-22
[React Version] Update Header Animation 2 2022-02-27 2022-09-13
Video thumbnails/previews on Profile Page always blur 0 2022-04-01 2022-07-18
Select which screen to run the game on 2 2021-12-18 2022-08-06
[MU4 Issue] Crash on clicking on any button in part name's context menu 3 2022-06-14 2022-08-31
Sending Animated PNG file breaks it by converting it to JPG 9 2022-03-23 2022-09-22
How to train faster RCNN with own region proposals with own dataset in caffe? 2 2018-06-29 2022-09-10
zmq.error.ZMQError: Operation not permitted 10 2019-03-27 2022-07-28
Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.nlp.pretrained.PythonResourceDownloader.getDownloadSize. : java.lang.NoClassDefFoundError: org/json4s/package$MappingException 1 2021-10-29 2022-09-25
New verification material property supporting JWK sets by reference 27 2021-12-18 2022-09-22
Parcel fails build on import of data uri 3 2021-08-28 2022-09-10
WebGL build error 2 2021-05-26 2022-01-19
clean.sh need to clean global cluster with containerd runtime 0 2021-08-27 2022-09-27
Typo in Readme.md 0 2021-04-13 2021-12-28
gradle testCompile() fails 2 2021-06-06 2022-09-17
Callback on Select not working 9 2020-08-31 2022-09-27
autojump/j not working in Raspberry Pi OS 32bit (debian buster) 6 2020-08-25 2022-09-09
ClearMetadataPreprocessor does not clear markdown cell tags 0 2022-02-02 2022-09-25
How to use the TrueDepth API in iOS? 0 2022-06-28 2022-09-16
Incorrect NaN gradient from distribution.Normal.log_prob when using subset 5 2018-12-12 2022-09-28
UX: Provide TV-friendly User Interface 4 2022-03-03 2022-09-27
future cannot be sent between threads safely 7 2021-09-16 2022-09-20
(DOCSP-17516): Backport DOCSP-17242 to 2.12 0 2021-07-12 2022-08-13
`IpAddr::from_str` is unnecessarily slow for IPv6 addresses 3 2022-03-10 2022-03-05
SIGSEGV error in TableReaderTailRecordCursorTest.lambda$testBusyPoll$1 1 2021-11-11 2022-08-06
Flaky ImportIODispatcherTest.testImportDropReimportDifferentSchema test 6 2021-11-11 2022-09-17
Add HTTPS support with Let's Encrypt Certificate 6 2017-09-08 2022-09-15
Liquibase generateChangeLog with --includeSchema=schema1,schema2 and --schemas doesn't prefix schema names for Postgres 4 2021-08-25 2022-09-16
Clicking on [src] in builtin types downloads the source file 5 2021-03-17 2022-09-16
QUIC connection handshakes have no timeout 9 2022-06-17 2022-09-27
Squidanalyzer very slow 6 2019-03-06 2022-09-27
Access remote clients through router 0 2019-10-16 2022-09-22
dependancyCheck analyse stop always at "Finished False Positive Analyzer" 1 2022-01-10 2022-09-25
Allow context-specific resource limits to be provided 1 2020-10-29 2022-08-21
Error: Failed to describe CompanionInfo(udid='25c87ecd12e841549181446a0bfce5f3855f222d', is_local=True, pid=85462, address=DomainSocketAddress(path='/tmp/idb/25c87ecd12e841549181446a0bfce5f3855f222d_companion.sock'), metadata={}), removing it 0 2022-08-29 2022-09-21
Failed to run `['--boot', <udid>]` 1 2022-09-24 2022-09-21
[CP] SliverReorderableList can not reorder on Android platform 4 2022-05-12 2022-09-16