Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to use this font http://www.dafont.com/ecran-monochrome.font?fpp=100, called "Écran Monochrome" in XeLaTeX.

As you can see it has a strange name, both because the accent and the space. XeLaTeX seems to be confused by this and it doesn't compile this document:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Écran Monochrome}
\begin{document}
123
\end{document}

The question is how do I specify this font in the document? I tried many variants of this name, like removing the accent, the capitalization and the space (see below for current error messages.)

Gives the error:

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

The TTF is well installed and usable from other applications (like LibreOffice in Linux.)

$ fc-list | grep cran
/home/user/.local/share/fonts/ecran-monochrome---monochrome-display.ttf: écran monochrome / monochrome display:style=Regular
share|improve this question
3  
Alternative solution: Use font file name instaed. Say, \setmainfont{ecran-monochrome---monochrome-display.ttf} –  Leo Liu Apr 5 at 6:44

1 Answer 1

up vote 5 down vote accepted

The Leo Liu's comment is actually a solution. We can use a file name of the font to load the font with the fontspec package. The similar problem is when a font is not actually installed or cannot be installed due to the user's limited rights on the computer and we still wish to use the font. We use ExternalLocation option for this purpose, I enclose an example where font was unzipped in the working directory and it hasn't been installed.

\documentclass{article}
\pagestyle{empty}
\usepackage{fontspec}
\setmainfont[ExternalLocation={./}]{ecran-monochrome---monochrome-display.ttf} % Écran Monochrome
\begin{document}
123
\end{document}

mwe

share|improve this answer
    
So, if the font is installed in user space (such as ~/.fonts or ~/.local/share/fonts/) then still XeLaTeX won't detect it? Where should it be detected? Do I have to tell XeLaTeX to update the database? After all was it a problem with the name of the font or the installation? –  alfC Apr 5 at 9:36
1  
@alfC XeLaTeX is browsing common font directories, it shouldn't be a problem. It is updating font database regularly. Well, we could run fc-cache -vf on our own, if needed. –  Malipivo Apr 5 at 9:47
    
Ok, I tried that, the only way I can make it work is to put the full path (ExternalLocation) even if it well installed (in userspace, such as ~/.fonts). –  alfC Apr 5 at 10:07
    
@alfC Hm, that is strange, both ~/.fonts and ~/.local/share/fonts are folders to be searched and they are a part of the font database. –  Malipivo Apr 5 at 10:25
    
@alfC Is the font's name Écran Monochrome or écran monochrome? –  cfr Apr 5 at 14:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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