[XeTeX] "if" tests for italic / bold into new command?
Andrew Moschou
andmos at gmail.com
Wed Dec 23 14:07:41 CET 2009
My metalogo package mentions these:
\ifdim\fontdimen\@ne\font\z@ is true if the current font is not slanted.
\if b\expandafter\@car\f at series\@nil is true if the current font is bold.
Here's an example:
\documentclass{article}
\makeatletter
\usepackage{fontspec}
\setmainfont{Georgia}
\newcommand\test{
\ifdim\fontdimen\@ne\font=\z@
Is upright
\else
Is italic or slanted
\fi
\if b\expandafter\@car\f at series\@nil
Is bold
\else
Is not bold
\fi}
\begin{document}
Something \test. \textit{Something \test.}
\bfseries Something \test. \textit{Something \test.}
\end{document}
It should be possible to to create new ifs based on these, say \ifbold and
\ifitalic, which I intend to put into the next update to metalogo.
Andrew
2009/12/23 Kārlis Repsons <karlis.repsons at gmail.com>
> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20091223/54aefc52/attachment.html>
More information about the XeTeX
mailing list