# How do I determine current font style in ConTeXt?

I want to define a macro that behaves differently within different font families. How do I determine the current font family used in ConTeXt? Is there something like \f@family variable?

• Does \fontalternative give you the information you are looking for? Or do you want \fontclass'. Jan 10 '16 at 16:38
• @Aditya: \fontalternative works fine) and how do I use \fontclass? can't find any documentation about either of them ... Jan 11 '16 at 14:37
• @Aditya: yeah, I need more info than \fontalternative gives. Something like ss, rm, etc. Jan 11 '16 at 14:49

## 1 Answer

ConTeXt has two axis for font definitions: font styles (serif, sans, and teletype) and alternatives (normal, bold, italic, bolditalic, slanted, boldslanted, and smallcaps). See the wiki for details.

The predefined font styles and alternatives are defined in font-pre.mkiv using the macros \definefontstyle and \definefontalternative. The macros \fontstyle and \fontalternative give the current font style and alternative. So, you can use a combination of these in your tests. For example:

\define[1]\Test
{\NC #1 Sample \NC #1 \fontalternative \NC #1 \fontstyle \NC \NR}
\starttext
\startTABLE[frame=off,offset=0.5em, align=middle]
\NC   \NC Alternative \NC Style \NC \NR
\Test{\rm}
\Test{\it}
\Test{\sl}
\Test{\it}
\Test{\bf}
\Test{\bi}
\Test{\ss}
\Test{\ssit}
\Test{\sssl}
\Test{\ssbf}
\Test{\ssbi}
\Test{\normal}
\Test{\italic}
\Test{\slanted}
\Test{\bold}
\Test{\bolditalic}
\Test{\sans}
\Test{\sansbold}
\stopTABLE
\stoptext
`

which gives