# Is testing f@shape considered best practice method for reliably detecting italic and slant modes?

Subject says it all.

Is testing f@shape the cleanest, clearest, simplest, most reliable way to check for italic and slant modes? e.g.:

\ifthenelse{\equal{\f@shape}{sl}}{italic}{not italic}
\ifthenelse{\equal{\f@shape}{it}}{slant}{not slant}


Obviously, without more context, the question is a bit broad—for example, rather than wrapping this in an \ifthenelse, it might be cleaner to set an internal length variable depending on the mode. In my case, I simply want to emit varying amounts of kerning in the middle of a macro—none for normal text, a little bit for slanted text, and a little more for italics. This is for a macro that typesets fractions. I've got it working but I'm just wondering if this is the cleanest way.

-
I'm struggling to see an answer beyond 'yes' :-) –  Joseph Wright Feb 2 '12 at 18:05
Oh yes, see: tex.stackexchange.com/questions/31649/… –  Joseph Wright Feb 2 '12 at 18:05
Depends on what you mean with "reliable". f@shape doesn't depend on some real font features - the authors of font packages can assign "it" or "sl" to whatever font they want. Also testing f@shape makes only sense for text font setup with nfss. The latex kernel checks \fontdimen1 to decide e.g. if \em should switch to \itshape or \upshape. –  Ulrike Fischer Feb 2 '12 at 18:26

Depends what you doing. In certain cases you maybe better off with \curr@fontshape, which gives more information. The command returns a value such as OT1/cmtt/m/sl. So if you are using various amounts of kerns depending on the font shape, it is worth exploring this command.
It will also be instructive to study how LaTeX, defines italic corrections (search in source2e), for textit and textsl, which presents a similar problem. What you are trying to do belongs a bit more upstream, perhaps a special font kerning table?
For best practices always study the LaTeX source2e and any well accepted related packages. Over the years the kernel has been optimized fairly well and any remaining issues are normally of a minor nature (Just texdoc source2e).