In Plain TeX (and really as a TeX primitive), \font\myfont=cmr8 at 10pt and \font\myfont\cmr10 both create fonts with "sizes" of 10pt. I want to be able to use this value to generate specific vertical spacing (e.g. always double, single, 1.1, 1.2 spaced) in a redefined macro of \font (it would use \afterassignment with \font to retain the normal semantics, especially the variability of putting a) nothing, b) at, or c) scaled). \fontdimen doesn't appear to provide this dimension. Although hacky, is there a representative character that I could create a box with and measure the height of that, or is there a more natural way to get this value?

I am able to use a macro \def\font#1=#2@#3{...}, but this breaks the old semantics. Note: this is a plain TeX question, so I want to avoid relying on higher level font frameworks.

  • 1
    I would use \fontcharht\font`\( + \fontchardp\font`\( Jun 24, 2020 at 8:47
  • 1
    if pdftex is an option, you could use \pdffontsize
    – Robert
    Jun 24, 2020 at 14:45

2 Answers 2


If you want to get the actual size instead of an approximation like the size of the parenthesis, you can use \fontname: \fontname always includes the size, except when the font is loaded in it's designsize. But if the font is loaded in it's designsize, you can load it again at a scaled size and extract the designsize from that.

The actual code looks a bit complicated because we have to scan for at in cmr10 at 12pt and the at has weird catcodes:

  \edef\specialAt{{ \string a\string t }}%
    \def\getfontsize##1=##2{% The user level macro
      \ifx*##2*% Loaded at designsize
          \font\tmpfont"##1" scaled 2000
          \divide\dimen0 by 2
      \else% Otherwise #2 holds the size. But is is followed by " at ", so we have to strip that
    \def\getfontsiZE##1##2#1{##1=##2}% Strip " at "

% Let's try using it: What is the size of \tenrm?
{\tt\string\tenrm} has size \the\dimen0.

cmr17 has size \the\dimen0.

Of course, you can combine this with egreg's answer to automatically assign the size of every loaded font to some macro.

enter image description here

  • I have replaced this as the accepted answer because the parenthesis method breaks on ptmr/ptmb (Times New Roman) fonts. Jun 26, 2020 at 1:19

You can define \xfont with the same syntax as \font, but so that \xfont\foo=cmr10 will also define \foosize with replacement text the height plus depth of a parenthesis in the font (as suggested by Ulrike Fischer).

  % #1 = font selection control sequence
  \dimen0=\ht0 \advance\dimen0 \dp0
  \expandafter\edef\csname\fontnametmp size\endcsname{\the\dimen0}%

\xfont\fontA=cmr8 at 10pt
\immediate\write20{\fontA = \meaning\fontA\space --- \fontAsize}

\xfont\fontB=cmr5 scaled 2000
\immediate\write20{\fontB = \meaning\fontB\space --- \fontBsize}

\immediate\write20{\fontC = \meaning\fontC\space --- \fontCsize}

\immediate\write20{\fontD = \meaning\fontD\space --- \fontDsize}


This will produce, on the terminal,

\fontA = select font cmr8 at 10.0pt --- 10.0pt
\fontB = select font cmr5 at 10.0pt --- 10.0pt
\fontC = select font cmr17 --- 17.24997pt
\fontD = select font cmbx10 --- 10.0pt
  • Why does cmr17 have a size of 17.24997pt? Jun 24, 2020 at 15:30
  • 1
    @ShreevatsaR Because that's the height plus depth of the parenthesis. The size declared in the TFM file is actually (DESIGNSIZE R 17.279999), but this information is not available to TeX.
    – egreg
    Jun 24, 2020 at 15:44
  • Thanks. Why doesn't the same apply to cmr8, cmr10, cmr12 (or in the above, cmbx10) — why don't they also have higher sizes than in the font name? (Sorry, I know this isn't strictly relevant to this question/answer and maybe I can look it up somewhere, just asking because it seems interesting.) Jun 24, 2020 at 17:10
  • @ShreevatsaR I guess you have to ask Knuth for this.
    – egreg
    Jun 24, 2020 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .