Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
But both fonts do have old style nums so the test is correct. If I use e.g. Arial I get a "no". If you want to test if old style nums have been activated you will probably have to inspect the list \l_fontspec_rawfeatures_sclist. –  Ulrike Fischer Feb 4 '13 at 16:29
    
Okay, so I apparently misunderstood the \fontspec_if_feature:nTF command. Thank you! –  MichaelF Feb 4 '13 at 16:47
    
@UlrikeFischer Can you add an answer? –  egreg Jun 1 '13 at 22:27
add comment

1 Answer

But both fonts do have old style numbers so the test is correct. If I use e.g. Arial I get a "no". If you want to test if old style numbers have been activated you will probably have to inspect the list \l_fontspec_rawfeatures_sclist

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.