How to get the default font name?

LaTeX keep the current values of the font attributes in internal macros. For example f@family will give you the family.

\documentclass{article}
\begin{document}
\makeatletter
\f@family
\makeatother
\end{document}

Similarly \f@encoding, \f@shape, \f@series etc.


Usually you write \fontname\font instead to extract the name (and size) of the currently selected font. The first thing that comes to mind for \the\font is when you want to define a create to switch to what is the currently font:

\expandafter \let \expandafter \switchback \the\font
\font\1=cmss10\1
hello
\switchback
previous font

As such, \the\font on its own is pretty much a no-op as it switches to the currently selected font.

Tags:

Fonts