# Continuously-sizable fonts?

Why are we stuck with a finite number of font sizes in LaTeX? Modern fonts are fully vector-based and scalable - why can't LaTeX do this? Or maybe it can, and I just don't know how.

Also see the question Continuously-sizable brackets?

-
\usepackage{lmodern}...\fontsize{8.785pt}{11pt}\selectfont –  egreg Jun 28 '11 at 17:00
Can you explain what you want to achieve that is imposssible or unknown to you? –  Taco Hoekwater Jun 28 '11 at 20:46
Use fixcm package for CM fonts. –  Leo Liu Jun 29 '11 at 5:41

As egreg has already commented, it is possible to load vector fonts at arbitrary sizes. Using a small set of sizes has a lot more to do with good design than any technical limitations. In general, most documents do not need lots of different sizes, but instead need a small set of sizes with a clear relationship. The size ratios commonly used by LaTeX have been established by printing tradition over very many years. Of course, if you are doing the design part of laying out a text then you may need to set up these 'logical' font sizes to map to arbitrary real sizes.

Another point is that most fonts have different design characteristics at different sizes. A classic case is the very smallest font sizes, which are often subtly different to their larger cousins. So scaling a 6 pt font to 12 pt may not give exactly the same result as using a native 12 pt version. So it's normally best to be conservative with scaling: 12 pt scaled to 12.5 pt is probably fine, but 6 pt scaled to 30 pt may well not be.

-

You can scale the font with an factor using the small scalefnt package. It provides the \scalefont{<factor>} macro to do this. The package does not come with a manual, but has some in-file documentation as comments:

This package defines a command \scalefont. After \scalefont{.75} then the current font and baselineskip will be scaled to 75% of their original size. Any scale factor may be specified.

If you are using traditional fd files based on bitmap font sizes, LaTeX's font system will round the requested font size to the nearest available size. If you are using scalable fonts, such as the psnfss or type1cm packages, then the requested font size will be used exactly.

It basically only executed \fontsize{<factor><current font size>}{<factor><current baselineskip>}\selectfont but also handles stretchable baselineskips (e.g. 12pt plus 1pt minus 1pt).

You can also scale small amounts of text using the macros given by graphicx, i.e. \scalebox{<factor>}{<text>} or \resizebox{<width>}{<height>}{<text>} (use ! for one of the two values if it should scale with the other one). However, the results may not always follow typographical standards.

A little bit related is the relsize package which provides the \smaller and \larger macros to make the font size smaller and larger, by changing automatically to the next lower or height predefined font size.

-

As @egreg suggested, you can use lmodern, a close simulacrum of Computer Modern. However, if you don't want to switch over to lmodern, you can also \RequirePackage{fix-cm} before the \documentclass{...} line. See also: this FAQ answer.

-

Another way of doing this, depending on what you want to do, is to use tikz (as always). You just need the "transform shape" option to nodes containing the text.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[transform shape]
\draw \foreach \x in {0.5,0.55, ..., 1.0} {node[scale=\x,anchor=mid west] {asdf} ++(0,-0.7)}
++(1.8,0)
\foreach \x in {1.0,1.05, ..., 1.5}  {++(0,0.7) node[scale=\x,anchor=mid east] {asdf}}
++(0.05,0)
\foreach \x in {1.5,1.55, ..., 2.0} {node[scale=\x,anchor=mid west] {asdf} ++(0,-0.7)}
++(3.3,0)
\foreach \x in {2.0,2.05, ..., 2.5} { ++(0,0.7) node[scale=\x,anchor=mid east] {asdf}};
\end{tikzpicture}
\end{document}


-