# How to make a font available for ALL system users

I'm developing a webpage and I'm interested in calling `pdflatex` to compile a `.tex` file in order to generate a PDF report. I test the command in the directory where the `.tex` is, then there is no problem.

However if the server executes the command I get the following error:

``````!pdfTeX error: pdflatex (file ecrm1095): Font ecrm1095 at 600 not found
==> Fatal error occurred, no output PDF file produced!
``````

And this missfont.log file is generated with this single line:

``````mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecrm1095
``````

Now here is the kicker. Whenever I use the command as a regular user it generates a `.texmf-var` directory which contains the font somehow. If then I try the compilation with php it works perfectly. But if I erase the folder and try the compilation again it fails with the above error. As far as I can tell it is because the apache user (www-data) does not see the font. And my regular user does.

I have searched the web and have found out that `updmap-sys` seems to make different font sets available system wide, but I can't figure out how to use it. Any help would be appreciated.

By default, TeX uses Computer Modern fonts in the OT1 font encoding. In most cases, this means metafont source fonts. I am not sure exactly how it works in this case but apparently whatever TeX needs is part of the existing TeX installation.

When you use `fontenc` and specify the T1 encoding, TeX tries to load Computer Modern in this encoding instead. If they are available, TeX will use type1 fonts. This is almost always what you want since these display correctly in all PDF viewers, even Adobe's (which has issues with metafont fonts looking crappy).

If the fonts are not available in type1 format, TeX will try to fall back to metafont. In this case, though, it needs to generate usable fonts from the source files. Usually, it does this in a user directory. For TeX Live, that is under `~/texlive/` by default. This, of course, requires write permission in the relevant directory. If TeX cannot create the fonts from the source, it fails with an error because the fonts are not available. It cannot use an alternative 'fall back' font because Computer Modern is, by default, the 'fall back'.

When you install `cm-super`, you install Computer Modern fonts in type1 format. This includes fonts configured for the T1 encoding, as well as OT1. If these fonts are available, there is no need for TeX to resort to metafont, no need for it to generate usable fonts from source, and no need for it to write files under `~/texlive/`.

So there is a permissions issue involved, I think. (Or else there is an issue to do with the configuration of the directory TeX should use to write these kinds of files.) But the best solution is, in any case, to use type1 fonts and the T1 encoding. (I am not sure whether there are other reasons you might need to solve the writing issue but you don't need to for this.)

There are two possible solutions:

• install `cm-super` and use the T1 encoding;
• use a font package which provides type1 fonts in whichever encoding you want to use (but T1 is a good choice for Western European languages).

For example, loading `lmodern` is another way to solve the problem. These are based on Computer Modern but there's no metafont version so TeX will use the type1 regardless of encoding.

Ok, so I found a workaround/another clue to the problem. I'm only posting it here so it might help anyone else.

Firs of all, I was wrong. This is not a user permission issue. I changed my server username to my own and I still had the font not found problem.

However I was able to isolate the problem to one of the latex lines.

In particualar it started working correctly as soon as I commented:

``````\usepackage[T1]{fontenc}
``````

The line was inherited from a header I always use, but was not fundamental to the document and hence this managed to solve it.

• Perhaps you need to install `cm-super`? Or use the `lmodern` package? Your PDFs will look crap in Adobe if you are using the default CM fonts because they are not type1 (as the output in your question suggests). The line you've commented will result in type1 CM being used if available (`cm-super`). Or Latin Modern is a good alternative (arguably better). – cfr Oct 7 '14 at 21:05
• Yessss!!!!!!!!!!! Thank you so very much. After installing cm-super (which I did not know that existed) It worked with the line uncommented!!! Thank you!!! Two things 1) could you post it as answer so I can check it? 2) Can you explain what does cm-super install exactly? – aarelovich Oct 8 '14 at 12:09
• Done! Let me know if anything is unclear ;). – cfr Oct 8 '14 at 20:36