\IfFontFeatureActive 不起作用

\IfFontFeatureActive 不起作用

在回答通过 fontspec 命令查询字体功能是否已激活\IfFontFeatureExists和有定义\IfFontFeatureActive。对于第二个,我没有得到可靠的结果。例如,下面说 是pnum活跃的,tnum是不活跃的,这显然不是事实。

\documentclass{article}
\usepackage[osf,tabular]{libertineRoman}

\ExplSyntaxOn
\cs_new_eq:NN \IfFontFeatureExists \fontspec_if_feature:nTF
\cs_new:Npn \mico_fontfeature_if_active:nTF #1
  { \tl_if_in:NnTF \l_fontspec_rawfeatures_sclist { #1 } }
\cs_new_eq:NN \IfFontFeatureActive \mico_fontfeature_if_active:nTF
\ExplSyntaxOff

\begin{document}

pnum \IfFontFeatureExists{pnum}{exists}{does not exist},
onum \IfFontFeatureExists{onum}{exists}{does not exist},
lnum \IfFontFeatureExists{lnum}{exists}{does not exist},
tnum \IfFontFeatureExists{tnum}{exists}{does not exist},

pnum is \IfFontFeatureActive{pnum}{}{not} active,
onum is \IfFontFeatureActive{onum}{}{not} active,
lnum is \IfFontFeatureActive{lnum}{}{not} active,
tnum is \IfFontFeatureActive{tnum}{}{not} active,

1234567890

\end{document}

相关内容