[XeTeX] "if" tests for italic / bold into new command?

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Dec 23 14:18:39 CET 2009


On 23/12/2009 12:52, Kārlis Repsons wrote:
> Not sure if XeTeX is very relevant, but maybe someone knows how could I make a
> new command, which has some if-then automations depending on if the specified
> font has italic or bold shapes?

Are we talking at the time the font is used or in the abstract? For the 
former case, you can test the NFSS flags:

\newcommand*\if at bold@text at TF{%
   \if b\expandafter\@car\f at series\@nil
     \expandafter\@firstoftwo
   \else
     \expandafter\@secondoftwo
   \fi
}

\newcommand*\if at italic@text at TF{%
   \if n\expandafter\@car\f at series\@nil
     \expandafter\@secondoftwo
   \else
     \expandafter\@firstoftwo
   \fi
}

(The second test is "backward" as it actually checks for the font being 
upright.)

Not so sure about the other case!
-- 
Joseph Wright


More information about the XeTeX mailing list