fontspec-color 无法与 microtype 包一起正确工作

fontspec-color 无法与 microtype 包一起正确工作

如果我将 fontspec 包与 microtype 包一起使用,则 fontspec 的颜色功能只会对段落的最后一行进行彩色化,而不是对整个段落进行彩色化,因为分组命令\addfontfeature应该可以工作。

\documentclass{article}

\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{microtype}

\setmainfont{DejaVu Serif}

\begin{document}
\twocolumn%
Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test.

\begingroup%
    \addfontfeature{Color=blue}%
    Test. Test. Test. Test. Test. Test. 
    Test. Test. Test. Test. Test. Test. 
    Test. Test. Test. Test. Test. Test. 
    Test. Test. Test. Test. Test. Test. 
    Test. Test.
\endgroup%

Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. 
Test. Test.
\end{document}

结果如下:

段落颜色很差

我将 LuaLaTeX 与fontspec.sty(2013/03/16 v2.3a) 和microtype.sty(2013/03/13 v2.5) 一起使用。

答案1

这是 中的一个错误luaotfload,而不是 中的microtype一个错误fontspec。(@AndrewStacey 不久前已经向我报告了这个问题。)普通的 luatex 也会发生同样的情况:

\input luaotfload.sty
\font\x="DejaVu Serif":color=FF00FF;expansion=default; \x
\pdfadjustspacing=2
\hsize=7cm
Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. 
Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. Test. 
\bye 

只有那些没有扩展的行才会显示颜色(这里是最后一行)。似乎来自luaotfload(在文件中otfl-font-clr.lua)的着色例程无法将扩展字体识别为相同基础字体的实例。

编辑:luaotfload感谢 Élie Roux 和 Philipp Gesang,该错误已在 v2.2 中修复。

相关内容