TransWikia.com

RequirePackage succeeds but font not found

TeX - LaTeX Asked on December 31, 2021

I am trying to build a CV with friggeri but I am trying to change the default font ‘Helvetica Neue’ with ‘Source Sans Pro’.

This means that I want to change:

newfontfamilybodyfont[]{Helvetica Neue}
newfontfamilythinfont[]{Helvetica Neue UltraLight}
newfontfamilyheadingfont[]{Helvetica Neue Condensed Bold}

defaultfontfeatures{Mapping=tex-text}
setmainfont[Mapping=tex-text, Color=textcolor]{Helvetica Neue Light}

to

newfontfamilybodyfont[]{Source SansPro}
newfontfamilythinfont[]{Source Sans Pro ExtraLight}
newfontfamilyheadingfont[]{Source Sans Pro Black}

defaultfontfeatures{Mapping=tex-text}

setmainfont[Mapping=tex-text, Color=textcolor]{Source Sans Pro Light}

in the frigerri-cv.cls file.

So I checked if I had ‘Source Sans Pro’ installed.

locate sourcesanspro returns all the otf files in the folder:
/usr/share/texlive/texmf-dist/fonts/vf/adobe/sourcesanspro/ and the sty file /usr/share/texlive/texmf-dist/tex/latex/sourcesanspro/sourcesanspro.sty

Seeing this I thought I will be fine, but…

I import in the package:

 RequirePackage[default]{sourcesanspro}

And then I try to use it:

 newfontfamilybodyfont[]{Source Sans Pro}

But this fails.

fontspec error: "font-not-found"
! 
! The font "Source Sans Pro" cannot be found.

I also tried setsansfont{Source Sans Pro} as in examples I have seen online but that also fails.

I tried running fc-list to check if the font is there, but it is not. Could this be the issue? What would you advise me to do? I am particularly puzzled because the RequirePackage command succeeds, so the package is there.

Thanks!

2 Answers

In my case, re-downloading the fonts from Adobe was not necessary, as they just need to be copied into the system font directory.

After installing the Texlive packages, the font files were installed to the directory /usr/share/texlive/texmf-dist/fonts/opentype/adobe/sourcesanspro/, but this did not make them visible to the OS. My solution, for Debian, was to copy the fonts into the system font directory.

cp -v /usr/share/texlive/texmf-dist/fonts/opentype/adobe/sourcesanspro/*.otf /usr/local/share/fonts

And then rebuild the font list

fc-cache -f

Now the Source Sans Pro fonts and were able to be used by setmainfont in xelatex. However, I still do not see the fonts in fc-list, but they are usable now. I did not need to change the name to 'Source Code Pro', 'Source Sans Pro' now works.

Answered by Sean Fahey on December 31, 2021

I have fixed the issue as follows:

installed the font globally by following the instructions here (note the wget link does not work anymore, so I installed from github).

After that I could see the font in 'fc-list' and I fixed the imports (the name was also written wrong).

newfontfamilybodyfont[]{Source Code Pro}
newfontfamilythinfont[]{Source Code Pro ExtraLight}
newfontfamilyheadingfont[]{Source Code Pro Black}
% %
defaultfontfeatures{Mapping=tex-text}
setmainfont[Mapping=tex-text, Color=textcolor]{Source Code Pro Light}

As @DavidCarlisle suggested I use these imports in my tex file instead of their cls.

Answered by elaRosca on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP