mtheme icon indicating copy to clipboard operation
mtheme copied to clipboard

Loading Fira from TeXLive fonts when using XeLaTeX

Open ArchangeGabriel opened this issue 8 years ago • 4 comments

Hi,

I’m starting to use this theme, and I face the following warning message:

kpathsea:make_tex: Invalid fontname `Fira Sans Light', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans Light Italic', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans Italic', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans Light OT', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans Light Italic OT', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans OT', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Sans Italic OT', contains ' '


Package beamerthememetropolis Warning: Could not find Fira Sans fonts on input 
line 95.

kpathsea:make_tex: Invalid fontname `Fira Mono', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Mono Bold', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Mono OT', contains ' '
kpathsea:make_tex: Invalid fontname `Fira Mono Bold OT', contains ' '

Package beamerthememetropolis Warning: Could not find Fira Mono fonts on input 
line 95.

This is expected on my system, because TeXLive fonts (and thus Fira, which is only there) are not available to the system. I know how to make it work, by loading the font per their filenames, like this:

\setsansfont[
    Extension      = .otf,
    UprightFont    = *-Light,
    ItalicFont     = *-LightItalic,
    BoldFont       = *-Regular,
    BoldItalicFont = *-RegularItalic
]{FiraSans}
\setmonofont[
    Extension   = .otf,
    UprightFont = *-Regular,
    BoldFont    = *-Medium
]{FiraMono}

What I don’t know is how exactly to patch the loading code in https://github.com/matze/mtheme/blob/master/source/beamerfontthememetropolis.dtx to add this as a third possibility if the two other ones fail. Especially, I’m not sure how to code the if condition.

Would you take a look at that and implement this? This would allow me to simplify my files and suppress those warnings from the compilation output. It would also helps for every people having not or mis-configured their system to handle TeXLive fonts.

Thanks!

ArchangeGabriel avatar May 15 '17 11:05 ArchangeGabriel

Looks like this is required on vanilla Debian where texlive-fonts-extra ships Fira fonts, but they are not picked up automatically. The above snippet fixes it for me.

As that package requires about 1GB of disk space, it'd be nice if Fira fonts weren't required (though of course recommended), so +1 for not having to either install the huge package or make the compilation fail.

mbanck avatar Nov 21 '18 15:11 mbanck

Using this answer I was able to get metropolis with Fira fonts working under Debian, without the above snippet.

Create the file /etc/fonts/conf.d/09-texlive-fonts.conf with this content

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/share/texlive/texmf-dist/fonts/opentype</dir>
  <dir>/usr/share/texlive/texmf-dist/fonts/truetype</dir>
  <dir>/usr/share/texlive/texmf-dist/fonts/type1</dir>
</fontconfig>

Then run sudo fc-cache -fsv.

m4lvin avatar Jan 14 '19 15:01 m4lvin

@m4lvin Yes of course, this is the most common setup, but then you add TeX Live fonts to your system fonts, which exactly what I’m avoiding.

ArchangeGabriel avatar Jan 14 '19 15:01 ArchangeGabriel

I installed the version from github but still get this warning

Package beamerthememetropolis Warning: Could not find Fira Mono fonts on input 
line 95.

I do have the font installed.

newptcai avatar Dec 11 '20 16:12 newptcai