# Why do font substitutions need to happen even with vector fonts?

I often get warnings saying Size substitutions with differences up to ... have occurred, even while using fonts like Palatino, which as far as I understand are defined to be arbitrarily scalable. Why do such substitutions happen at all?

Also, is there a systematic way of figuring out which variation of the font is causing the problems, and to manually force the compiler to include the correct sizes?

I have very basic knowledge about how fonts are handled in the TeX backend, so if my questions don't make sense at all, please feel free to enlighten me.

Edit: I am not looking for a way to make the warnings go away on any particular document I compile. As long as the result looks correct, I usually ignore all such warnings. I am just trying to understand why this happens, even when using a package like mathpazo. If it's still helpful, I have provided an MWE created from the last document I encountered this in.

\documentclass{article}
\usepackage{mathpazo,amsmath,stmaryrd}
\begin{document}
$\text{$a$}$
\end{document}


From the answers already given, I would guess that some macro somewhere ends up using a bitmap font.

• Could you make an example? – egreg Aug 18 '13 at 8:41

You don't get errors but warnings and if the values are small you normally can simply ignore the warnings.

Font sizes can be declared (in the .fd files) in discrete steps or continuously. In the first case LaTeX will choose the next discrete size if the currently requested size is not in the list and warn you about the substitution.

It is quite possibly to use a continuous declaration also for bitmap fonts - but as this means that for every new size a new font has to be created old .fd did avoid this to save disk space - nowadays it wouldn't matter.

Size substitutions warnings indicate in most cases that you are using some historical .fd-file which can be used with bitmap fonts too. A lot of the warnings can be avoided by adding \RequirePackage{fix-cm} before \documentclass.

The St. Mary Road fonts have been set up with optical sizes, stmary5, stmary6, stmary7, stmary8, stmary9 and stmary10. The Ustmary.fd file has been written in times when arbitrary sizing was not possible, because each size would have meant producing a new .pk bitmap file.

The fonts have since been converted to Type1, but the .fd file still doesn't acknowledge it. You can teach LaTeX to use arbitrary size with something like

\documentclass{article}
\usepackage{mathpazo,amsmath,stmaryrd}
\DeclareFontFamily{U}{stmry}{}
\DeclareFontShape{U}{stmry}{m}{n}
{
<-5.5>  stmary5
<5.5-6.5> stmary6
<6.5-7.5> stmary7
<7.5-8.5> stmary8
<8.5-9.5> stmary9
<9.5->  stmary10
}{}

\begin{document}
$\text{$a$}$
\end{document}


so that the .fd file will not be read and a font for any size will be defined.

It has to do with optical sizes. There are additional files for a font telling how to look in a certain size (roughly speaking) and you get a warning if there was no information for you desired size so so another (nearby) size is used.

You can fix this by using another font package, e.g. pxfonts for palatino:

\documentclass{article}

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

\begin{document}
\fontsize{12pt}{13pt}\selectfont
This is a text in 12.0\,pt. XX
%
\fontsize{12.5pt}{13pt}\selectfont
XX This is a text in 12.5\,pt.
\end{document}


• both pxfonts (and mathpazo) provide more sophisticated handling of palatino, but the psnfss package does do scaling "correctly". so the problem is unlikely to be solved by replacing palatino.sty; hence the importance of an example that shows the problem (and thus shows us what other fonts are in use). – wasteofspace Aug 18 '13 at 9:40