[Tex/LaTex] Setting figure caption font face

captionsfontsfontspec

I'd like to change font face of all figure captions. I'm currently using the fontspec package to set main font of the document. I'm also using DeclareCaptionFormat to set font size.

I fail to see any way to set font face of captions. Is there some combination of fontspec and caption packages that allows to do that?

Best Answer

Here's one way of doing it - specifying a caption format and then associating it with the figure float:

enter image description here

\documentclass{article}
\usepackage{fontspec,lipsum,caption,graphicx}
\setmainfont{Source Sans Pro}% Main document font
\newfontfamily\figcapfont{TeX Gyre Pagella}% Some other font
\DeclareCaptionFormat{figcapfont}{\figcapfont \textbf{#1#2}#3}
\captionsetup[figure]{format=figcapfont}
\begin{document}
\begin{figure}[ht]
  \centering
  \includegraphics[width=.3\linewidth]{example-image}
  \caption{This is a caption for a figure.}
\end{figure}
\lipsum[1]
\end{document}
Related Question