I'm trying to emulate the behaviour of a [pdf]LaTeX package that provides commands \lstyle, \ostyle, \tstyle, and \pstyle to activate lining, oldstyle, tabular and proportional figures, respectively. But they are context-dependent so that, for example, \lstyle might be Proportional,Lining or Monospaced,Lining, depending on the current features. With traditional font selection commands I can use \f@family to determine which family is current. Is there some way of doing this using fontspec? The cautionary note in the documentation for \addfontfeatures suggests otherwise.

  • 1
    \f@family continues to store the name of the current font family. It does not obey ‘rules’ about a trailing j or x, though.
    – egreg
    Nov 17, 2013 at 17:12
  • It's actually font features that I need access to in the fontspec environment. I have found definitions of \IfFontFeatureExists and \IfFontFeatureActive in an answer to an earlier question. I think the latter will solve my problem.
    – user22108
    Nov 17, 2013 at 17:59
  • \IfFontFeatureExists works but the following definition doesn't:\cs_new_eq:NN \IfFontFeatureActive \mico_fontfeature_if_active:nTF. What's wrong?
    – user22108
    Nov 17, 2013 at 18:17
  • Not answering your question in the comment, but the discussion in the following question about how \addfontfeatures works might be useful to you. Lining numbers not working in certain fonts
    – Alan Munn
    Nov 17, 2013 at 18:27
  • I'm not using \addfontfeatures, I'm using \newfontfamily; but to know which features to activate, I need to know which features are already active.
    – user22108
    Nov 17, 2013 at 18:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.