# Using multiple fonts in ConTeXt

As I'm learning a bit more about ConTeXt I'm finding that fonts is a very complex topic. Recently, I found myself wanted to do the following:

• Use one font for the title page and section headings
• Use a second font for normal text
• Section headings would have size and bold variations at different levels

This is what I ended up with:

\definefontfamily[titleface][sans][proximanova]

\setupbodyfont[mainface]
\definemakeup[titlepage][style=titleface]

\starttext
\starttitlepagemakeup
Some title page content.
\stoptitlepagemakeup

\startbodymatter
\section{First}
This is normal. {\bf This is bold.} {\em This is italic.} This is normal.
\subsection{First First}
This is normal. {\bf This is bold.} {\em This is italic.} This is normal.
\stopbodymatter
\stoptext


This allowed me to use Proxima Nova for the title page and Baskerville for the normal text. I've been trying to figure out how to use setuphead to now use the same titleface but with bold and at different sizes for sections and subsections, but I'm unable to figure this out.

What's the proper way to do this?

• Off-topic: When preparing MWEs it's always a good idea to use fonts that are available to everyone such as TeX Gyre Heros and TeX Gyre Pagella (if you want a Sans/Serif pairing) because otherwise ConTeXt loads the same fallback font in both cases. – TeXnician Nov 29 '18 at 17:33
• @TeXnician Thanks for the tip. Will do so in the future. – Roxy Nov 29 '18 at 19:01

You can choose between different method to change the font for certain elements, for example section titles. The easiest method is to use a different typeface with the \switchtobodyfont command.

\setupbodyfont[pagella]

[section]
[style={\switchtobodyfont[dejavu,14pt]\bf}]

\starttext

\section{Knuth}

\samplefile{knuth}

\stoptext


A better solution is to create a new font for each section type where you can set the size of the font.

\setupbodyfont[pagella]

\definefont [ChapterStyle] [file:dejavuserifbold*default at 14pt]

[section]
[style=ChapterStyle]

\starttext

\section{Knuth}

\samplefile{knuth}

\stoptext


When you already have existing typescripts for the section font you can use the \classfont commands which takes the name typescript and the alternative as arguments.

\setupbodyfont[pagella]

\definefont [ChapterStyle] [\classfont{dejavu}{SerifBold} at 14pt]


• Thanks. I'm trying to follow your second example. It works, of course, but it no longer works when I try to use my custom font, which I load with \definefontfamily[titleface][sans][Proxima Nova]. If I then use \definefont [ChapterStyle] [titleface at 14pt] it does not load the font properly. I know the first statement worked because I can use titleface as a style parameter to \definemakeup, as in my original example. What am I missing? – Roxy Nov 30 '18 at 4:22
• \definefont is a wrapper for the low level \font command and it expects the name of a font file. In my example I used the filename for DejaVu Serif Bold but it’s also possible to use the name of a font synonym, e.g. SerifBold. What isn’t possible is to use the name of a typeface (e.g. titleface) because it doesn’t reference a single font but I got around this with my third example where I picked the bold alternative from the dejavu typeface. – Wolfgang Schuster Dec 2 '18 at 11:15