Using XeLaTeX and fontspec, I want to test if the currently selected font has old style numerals (which I use in the main font, but not in the sans font). According to the fontspec documentation, it should be possible to test this using \fontspec_if_feature:nTF. The Open Type feature for old style numerals is called onum. So the following code should do the job:
\documentclass{minimal}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Numbers=OldStyle]{Linux Libertine O}
\setsansfont[]{Linux Biolinum O}
\ExplSyntaxOn
\def\testforonum{\fontspec_if_feature:nTF{onum}{yes}{no}}
\ExplSyntaxOff
\begin{document}
Test 123. Old style: \testforonum
\textsf{Test 123. Old style: \testforonum}
\end{document}
However, it says "yes" in both cases. Does anybody understand why?
\l_fontspec_rawfeatures_sclist. – Ulrike Fischer Feb 4 at 16:29\fontspec_if_feature:nTFcommand. Thank you! – MichaelF Feb 4 at 16:47