# Why is my font changing when i change the size?

My problem is that the font seems to change when I change it's size with \fontsize.

I am trying to adjust the size of a font within an acm template author block. I'm using the code from this post to print out the font info.

When I print out the font info before changing anything I get the first line. Then I call

\fontsize{13 pt}{1 em} \selectfont


and I get the second line. Finally I tried to change the family with

\fontsize{13 pt}{1 em}\sffamily \selectfont


and I get the third line which kind of looks right but seems to be magnified rather than a real font size and is also clearly a different family from the other two.

Edit: While creating a MWE I discovered it's some weirdness with the acm cls file.

The example is:

\documentclass{acm_proc_article-sp}

\begin{document}

\title{problem with my unit}

\numberofauthors{1}

\makeatletter
\newcommand{\showfont}{encoding: \f@encoding{},
family: \f@family{},
series: \f@series{},
shape: \f@shape{},
size: \f@size{}
}

\author{
\alignauthor
\showfont\\
{\fontsize{13 pt}{1 em} \selectfont \showfont }\\
{\fontsize{13 pt}{1 em}\sffamily \selectfont \showfont }\\
}

\maketitle
\end{document}

• Are you sure you can use a unit such as em in the second argument? The value of em depends on the font size! – Bernard Oct 5 '14 at 2:24
• Welcome to TeX SE! I think we are going to need a minimal working example (MWE). It is expected that \sffamily will use a different font. That is the sans-serif family as opposed to the default, roman/serif one. (\ttfamily would produce a third family.) Obviously you are not using the default fonts, so an MWE will be key to figuring out the other disparities. – cfr Oct 5 '14 at 2:25
• @Bernard I wondered about that but, if I try it with CM, I don't get any complaints - just a warning about size substitutions because there is no 13pt cmr. While em is font size dependent and while I wouldn't recommend using it here, TeX could do this sensibly if the \baselineskip is set after the font is selected. However, I wouldn't be confident about that a priori. – cfr Oct 5 '14 at 2:27

the link you gave is no longer good, but I found a version of the class

Note that \fontsize{13 pt}{1 em} is not an error but the lengths are absorbed at this point, before the font is selected, so the baseline spacing will be set to 1em in the current font before this setting (which typically won't be big enough)

Your document with the class file as found now produces

If I modify the document to start of with tx fonts as in your output by adding

\renewcommand\rmdefault{txr}
\renewcommand\sfdefault{txss}


to the preamble I get

which more or less matches what you show.

Presumably the question is why the 9pt and 13pt size are more or less teh same size, and the first one is sans serif. The reason can be seen by adding a \selectfont before the first \showfont. This brings the actual font used into sync with the LaTeX macros such as \f@size that record the last requested font size.

\author{
\alignauthor
\showfont - \selectfont\showfont\\
{\fontsize{13 pt}{1 em} \selectfont \showfont }\\
{\fontsize{13 pt}{1 em}\sffamily \selectfont \showfont }\\
}


produces

where you see that the \selectfont forces the first line into using the real 9pt roman font that is visibly smaller than the 13pt on the next line.

Without the \selectfont despite the macros being set as shown by your \showfont the actual font is a 13pt sans serif left over from setting the title.

The reason why the font choices are not following latex conventions is the unfortunate way they have been declared in the class. For example authors are set using \aufnt for "author font" but this has not been defined in terms of the LaTeX family/size axis, it is defined as

\newfont{\aufnt}{phvr at 12pt}


which is a very thin wrapper around the \font primitive and defines \aufnt as a primitive font selection that ignores all latex relative font changes such as \bfseries` or size changes.