4

Today i figured out how to use system-installed-fonts with the fontspec-package and LuaLaTeX. But i can't figure out how to use fonts, that are installed in my texmf-tree!

The fontspec-Manual says (p. 10), that LuaLaTeX will see fonts installed in my texmf-tree and i can enter the name via a human readable-string (eg. Latin Modern Roman) or the filename (eg. ec-lmr10.tmf).

Even though i have confirmed that this file (and hence the font) is installed on my system in my texmf-tree, i can't get it to compile! I always get a

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "ec-lmr10.tfm" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.13 \setmainfont{ec-lmr10.tfm}

?

Am i getting something wrong? How can i use LaTeX-fonts with fontspec and LuaLaTeX?

  • 1
    you can not load tfm fonts via fontspec (latin modern is available as OpenType, and is the default font in lualatex so you do not have to do anything at all toi get latin modern) – David Carlisle Sep 1 '18 at 13:44
  • What is wrong with \usepackage{lmodern} if you want to use these fonts if not using the default ones? – TeXnician Sep 1 '18 at 13:45
  • The question wasn't specifically about Latin Modern, it was about fonts in the texmf-tree! So, in general i would be better of with installing the desired font manually and using it like a system-font? – Tim Hilt Sep 1 '18 at 14:15
  • @TimHilt The file name is lmroman10-regular.otf (for 10 pt) – Joseph Wright Sep 1 '18 at 14:19
3
\documentclass{article}
\begin{document}
foo
\end{document}

running with current lualatex from TeXLive creates a document with the icluded Latin Modern:

$ pdffonts zzz2.pdf 
name                      type              encoding         emb sub uni object ID
------------------------- ----------------- ---------------- --- --- --- --------- 
NAGORB+LMRoman10-Regular  CID Type 0C       Identity-H       yes yes yes      4  0
3

fontspec is made for Open-Type-Fonts, that's why the .tfm-file didn't work. Also, @JosephWright pointed out the right name for the mentioned Latin Modern Roman font which i can therefore use with fontspec.

When i may want or need a certain font, .ttf or .otf would be the best format for fontspec to deal with. Such fonts can be found with

fc-list | grep <font-name>*.ttf
fc-list | grep <font-name>*.otf

for system-installed-fonts or

find /usr/share/texmf-dist/fonts/ -name <file-name>.ttf
find /usr/share/texmf-dist/fonts/ -name <file-name>.otf

for fonts in my texmf-tree.

If some font is not installed in my system or not available in the desired format through the tex-installation, there's the possibility to install the font via a package or put the matching .ttf / .otf file in .fonts and run fc-cache -f -v to update fc-list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.