[Tex/LaTex] Change caption font using xelatex

captionsfloatsfontsxetex

I'm new to xelatex, but I've managed to change the font of the chapter, sections, and so on. Now, I want to change the global font of the float captions (figures, tables…). I've named the font "\captionfont", as you can see.

Below, you'll find a minimal working example, where I have not done any modifications. I guess the problem lies within the captionsetup.
I've read a lot about setting the font, and I've now settled for this way of doing it, so if it is possible to set the caption font globally, without changing too much of the original code, it'd great.

\documentclass[12pt,a4paper,english]{report} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%---- FONTS ----
\usepackage[math-style=ISO]{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
\setmainfont[Numbers={Proportional},SmallCapsFeatures={LetterSpace=6},
         BoldFont={Minion Pro Bold},BoldFeatures={LetterSpace=3}]{Minion Pro}
\setmonofont{Minion Pro}
\newfontfamily\chapterfont{Neo Sans Std}
\newfontfamily\sectionfont{Neo Sans Std Medium}
\newfontfamily\captionfont{Neo Sans Std} 
% ---- END FONTS ----
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{font=small,labelfont=bf,margin={0cm,0cm},justification=justified,singlelinecheck=off} 

\titleformat*{\chapter}{\huge\chapterfont}

\begin{document}
Here goes some text with the font X.
\begin{figure}
\includegraphics[width=1\textwidth]{dummyfigure}
\caption{This should be font \captionfont}
\end{figure}
Here continues font X.
\end{document}

I hope someone can fix it for me 🙂

Best Answer

This should give you the desired caption font:

\DeclareCaptionFormat{neofont}{\captionfont\small#1#2#3}
\captionsetup{format=neofont,labelfont=bf,margin={0cm,0cm},justification=justified,singlelinecheck=off} 

A complete reduced example:

\documentclass[12pt,a4paper,english]{report} 
\usepackage{caption}
\usepackage{fontspec}

\newfontfamily\captionfont{Neo Sans} 

\DeclareCaptionFormat{neofont}{\captionfont\small#1#2#3}
\captionsetup{format=neofont,labelfont=bf,margin={0cm,0cm},justification=justified,singlelinecheck=off} 

\begin{document}
Here goes some text with the main font.
\begin{figure}
\includegraphics[width=1\textwidth]{example-image-a}
\caption{This is on Neo Sans font}
\end{figure}
Here continues main font.
\end{document}

The output:

enter image description here

I used Neo Sans instead of Neo Sans Std, but the idea is the same.