[Tex/LaTex] Avoid embedding Helvetica to change to Arial

fonts

This question is essentially about the opposite of this question combined with this question.

I am using Latex to create a PDF for printing, which I would ideally like to be in Arial. I've currently got it in Helvetica, but I can't persuade the uarial package to work. I wondered whether, given that PDF readers might replace Helvetica with Arial if the Helvetica is not embedded, this might be a work-around for getting my document into Arial.

Does this work, and if so how is it achieved?

I tried telling ps2pdf not to embed all fonts, but I seemed to end up with an alternative font embedded instead of nothing.

Best Answer

I wondered whether, given that PDF readers might replace Helvetica with Arial if the Helvetica is not embedded, this might be a work-around for getting my document into Arial.

If a font is not embedded, then the behaviour depends on the PDF viewer, user settings, OS, available fonts, and system and user font configuration.

That is, if the font is not embedded, all bets are off: you cannot know what will happen. For example, the viewer might first see if the font is available (e.g. Helvetica is installed), then read a font-substitution list to see if it has instructions regarding Helvetica specifically, then try to figure out what kind of font might be a reasonable fall-back. Or it might ask the system's font configuration tools for Helvetica. Those tools might then see if Helvetica is covered by its substitution rules or otherwise try to find an alternative.

The font used might or might not be Helvetica. If not, it might, if you are lucky, at least be a sans somewhat like Helvetica (hopefully, but not necessarily, with the same metrics). It might or might not recognise, for example, ligatures correctly. If it doesn't, it might just leave gaps or it might use empty boxes. (It probably won't use e.g. 2 'f's - at least, I've never seen this relatively happy substitution for 'ff'.)

It is therefore a much better idea to:

  1. get uarial working, if you can, if that's what you want to use;
  2. embed another font, if you can't, even if it is not your first choice.

uarial

The uarial package should work fine:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Uncomment the map line if you are in either of the following 2 situations:
% uarial is installed, but the font map files for the system have not been correctly updated
% uarial is not installed at all, but you have put all the files from the package in your working directory (*.sty, *.fd, *.map, *.pfb, *.tfm, *.vf)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pdfmapfile{+ua1.map}
\usepackage{uarial,kantlipsum}

\begin{document}
\sffamily
\kant[1-3]
\end{document}

<code>uarial</code>

The above is the font A030, installed with the get-non-free-fonts script (getnonfreefonts-sys variety).

To actually get a font called Arial, I can compile the following with LuaLaTeX or XeLaTeX, provided a font with this name is installed for my system (e.g. in /usr/share/fonts):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{kantlipsum}
\setmainfont{Arial}

\begin{document}
  \kant[1-3]
\end{document}

Arial

I am guessing that when you say that you are using Helvetica, you are actually using NimbusSanL. This is what you would get using the above code with helvet in place of uarial.

NimbusSansL

Another option would be TeX Gyre Heros, which is supported by the tgheros package:

TeX Gyre Heros

Here, for the record, is a font which is actually called HelveticaNeue:

HelveticaNeue

Embedding

Whether fonts are embedded or not depends on a range of factors:

  1. TeX distribution and version;
  2. kind of font;
  3. compilation engine;
  4. system-wide and, possibly, user-specific configuration;
  5. more....

For a current (2015) installation of TeX Live from upstream, embedding is configured in updmap.cfg. System-wide defaults are in $(kpsewhich -var TEXMFDIST)/web2c/updmap.cfg. Instructions at the top of the file explain how to override settings system-wide and/or (in some cases) on a user-by-user basis.

For example, the line

LW35 URWkb

determines which fonts TeX Live uses when I load helvet. In this case (as I've not overridden this anywhere), it is using URW versions named according to the Karl Berry font-name scheme.

dvipsDownloadBase35 true

tells dvips to embed the 35 standard PS fonts.

pdftexDownloadBase14 true

tells pdftex to embed the 14 base PDF fonts while

dvipdfmDownloadBase14 true

tells dvipdfm(x) to do the same. Finally

kanjiEmbed noEmbed

tells dvipdfmx not to embed the Kanji fonts.

Beyond this, lines in individual .map files determine the lines which end up in the system-wide .map files, and these, too, can affect embedding e.g. by embedding subsets rather than entire fonts in certain cases.

On my system, I can override the settings from updmap.cfg above in a corresponding file in TEXMFLOCAL. I can also override them, I think, using a similar file in TEXMFHOME. However, the way in which updmap and updmap-sys work has changed more than once in recent editions of TeX Live. What is true for TL 2015, therefore, may or may not be true for TL 2013 or TL 2011 etc.

This all also depends, ultimately, on settings in texmf.cnf which determine which TEXMF trees are recognised, in which order they are searched and how they are to be searched. Again, this depends on TeX distribution, version and packaging, and on whether the default configuration has been altered by the system administrator.

If you are using Red Hat's packages, for example, the default configuration will be different, and, obviously, your system administrator may have made further changes.

EDIT

Here's a comparison of 4 fonts on my machine (font names on the right).

comparison