# What is the difference between the scalefnt and anyfontsize packages?

What is the difference between the scalefnt and anyfontsize packages?

Even though I use scalefnt, I get font size substitutions of up to "2.30002pt" in a document I am currently editing. The documentation of anyfontsize states that it doesn't yet work with "pdfLaTeX + the EC fonts", but what does that mean? It doesn't work with either, or it just doesn't work with this combination? And what exactly are EC fonts?

(If this is relevant: I am using memoir, times, microtype, and many other packages.)

-
The note says "doesn't work well with pdflatex + EC fonts" and explains why; however, that note is a leftover, because pdflatex has been perfectly able to create PK fonts on the fly since several years. EC fonts are the T1 version of the Computer Modern fonts, and are available in Type1 version (as CM-Super), so PK generation is not a problem any more. If you are using the (obsolete) package times, then anyfontsize is perfectly useless to you; not because times is obsolete, but because the fonts chosen by it are scalable to begin with. – egreg Feb 21 '13 at 22:32

oops I googled for those packages and found I wrote one of them:(

The main difference between them is that they don't have anything in common.

scalefont does not affect the underlying font machinery at all it just does a \fontsize{}{}\selectfont command where the arguments of \fontsize are the specified factor of the current values. So it just asks for a font of a given size and whether you get font substitutions or not is unchanged.

anyfontsize redefines the low level font loading NFSS machinery in LaTeX so that any rule that tries to force fonts to a fixed list of predefined sizes is changed to use a rule that scales the nearest available declared font size to the requested size. The fixed font size rules made a lot more sense in the era when almost all fonts were bitmap format.

If you are using times or any other naturally scalable font setup I wouldn't have expected anyfontsize to have any affect as they are already scalable.

-
Okay, but why do I get those size substitutions of up to about 2pt? Example: LaTeX Font Warning: Font shape `U/stmry/m/n' in size <4.58298> not available / (Font) size <5> substituted on input line ... Similar for U/mathb/m/n, and a few other fonts. And, can I avoid these warnings? – Lover of Structure Feb 21 '13 at 23:38
so you are using the stmary's road font, not sure if that is available in scalable form if it isn't you have to decide if you really want to allow bitmaps at any size, if you d anyfontsize they go away, or don't use \scalefont just access fonts at normal sizes then the problem won't arise – David Carlisle Feb 21 '13 at 23:40
I just added anyfontsize, and the warnings (almost) all magically went away! Well, that was easy ... But, why would I not want to allow fonts at arbitrary sizes? – Lover of Structure Feb 21 '13 at 23:44
scaling a scalable font is essentially free. a bitmap font has a bitmap image of every glyph so if you generate it at 10pt and 10.01pt and 10.02pt because of rounding error your disk fills up very quickly, that is why latex allows you to pre-define the sizes at which a font is available and substitutes the nearest – David Carlisle Feb 21 '13 at 23:53
yes latex allows you to specify essentially arbitrary mamping rules in the fd file see section 4.4 of fntguide in the base latex distribution. But perhaps better is to check if any fonts you need are available in scalable form, that is better anyway as bitmap fonts are rubbish in pdf they are optimised for a particular printer, so tend to break up and scale badly if teh pdf viewer is zoomed. – David Carlisle Feb 22 '13 at 0:08