[XeTeX] "if" tests for italic / bold into new command?
Kārlis Repsons
karlis.repsons at gmail.com
Wed Dec 23 14:30:00 CET 2009
On Wednesday 23 December 2009 13:26:28 Kārlis Repsons wrote:
> On Wednesday 23 December 2009 13:07:41 Andrew Moschou wrote:
> > 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
>
> Thank you! However, I was thinking about specified font name (string) and
> subsequent test within the new command. Could that be done?
Sorry, I didn't clarified again: to test if font named X has bold/italic/..!
My command just receives a font name and has to demonstrate font features...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://tug.org/pipermail/xetex/attachments/20091223/654f24e8/attachment.bin>
More information about the XeTeX
mailing list