\\selectlanguage{} 在非 normalsize 环境中累积单词间距

\\selectlanguage{} 在非 normalsize 环境中累积单词间距

以下 MWE 显示了一种效果,即非 normalsize-d 文本块中的单词间距随着\selectlanguage引入以前未使用的语言而“增长”(使用 lualatex):

\documentclass[oneside]{book}

\usepackage[main=german,bidi=basic]{babel}
\babelprovide[import]{english}
\babelprovide[import]{french}
\babelprovide[import]{portuguese}
\babelfont{rm}[%
  WordSpace = 1.5
]{texgyrepagella-regular.otf}
\parindent0pt
\parskip.5\baselineskip

\def\test#1{%
\selectlanguage{#1}%
normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal normal\par
\bgroup\small
 small small small small small small small small small small small small small small small small small small small small small small small small small small small small
\egroup\par}
\def\Test{%
\test{german}
\test{english}
%% un-comment the following two lines to strengthen the effect and observe the results after the FIRST lualatex run, and after CONSECUTIVE lualatex runs!
%\test{french}
%\test{portuguese}
}
\begin{document}

\Test
\Test
\Test
\end{document}

结果:

渲染结果显示第一个小块中的字间距比后续块中的字间距更窄

(请注意第二个“小”块与第一个块之间的间距。)

当定义中的\test{french}和行被取消注释时,效果会更强。还请注意,在 取消注释这些行后,第一次运行后的普通文本渲染结果与第二次运行后的渲染结果不同。\test{portuguese}\Test

此效果在 2019 年 6 月从 CTAN 源安装的 texlive2019、2020 年 2 月安装的 texlive2019 以及 2020 年 10 月安装的 texlive2020 中均可见。

我的问题是:在不更新 texlive 和/或 babel 包的情况下,是否有针对该问题的本地修复?我需要让它在早期的 texlive 2019 版本中运行,因为这是在活动生产机器上运行的 texlive。

答案1

我可以在没有的情况下重现该问题babel,因此它似乎是 中的一个错误fontspec,或者至少是一个意外行为。一个可能的解决方法是确保WordSpace仅执行一次:

\babelfont{rm}[WordSpace = 1.5]{texgyrepagella-regular.otf}
\babelfont[english, french, portuguese, german]{rm}{texgyrepagella-regular.otf}

在这个特定的例子中,它对我有用。

相关内容