[Tex/LaTex] Use custom font in newest Europass CV layout

europasscveuropecvfontsxetex

I'm using XeLaTeX to make my Europass CV, because I want to use a custom system font.

I've used the package europecv without any problem before understanding it gets me the old CV layout.

\documentclass{europecv}
\usepackage[a4paper,top=1.27cm,left=1cm,right=1cm,bottom=2cm]{geometry}
\usepackage{fontspec}
\setmainfont{Ubuntu}

\begin{document}
\begin{europecv}

\ecvpersonalinfo[20pt]

\end{europecv}
\end{document} 

old layout with custom font

But, trying to use the class europasscv, which gives the new 2013- layout, something goes wrong

\documentclass[a4paper]{europasscv}
\usepackage{fontspec}
\setmainfont{Ubuntu}

\begin{document}
\begin{europasscv}

\ecvpersonalinfo

\end{europasscv}
\end{document}

LaTeX Font Warning: Font shape `EU1/phv/m/n' undefined

(Font) using `EU1/lmr/m/n' instead on input line 6.

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

new layout

Line 6 being the one corresponding to \begin{europasscv}.
As a side note, even if irrelevant, the font I'm trying to use is, as can be read from the source code I've posted, Ubuntu Regular. I'm on Arch Linux and I've installed it using the distro's package ttf-ubuntu-font-family. Anyway, works with no problem on the old class. Something in the new one's title isn't compatible with the font, or any custom one, as I've tried with others as well.

Best Answer

In the class file Helvetica (phv) is hardcoded all over the class, so we ask fontspec to use Ubuntu everywhere phv is requested with \newfontfamily\myfont[NFSSFamily=phv]{Ubuntu}:

\documentclass[a4paper]{europasscv}
\usepackage{fontspec}
\setmainfont{Ubuntu}
\newfontfamily\myfont[NFSSFamily=phv]{Ubuntu}

\begin{document}
\begin{europasscv}

\ecvpersonalinfo

\end{europasscv}
\end{document}
Related Question