# Retrieve the current font, scale it, and change the font to that version

I'm using Plain TeX (and eplain, if that matters). I would like to be able to generically scale the current font, no matter how the current font has been set. For example, I want to write a macro

\def\VandV{V\hskip-3pt{\abitsmallerthanthecurrentfont\&\hskip-3ptV}


and I want \abitsmallerthanthecurrentfont to make the ampersand a bit smaller.

IIRC, In LaTeX, without packages, one can use \Large and \tiny and such to affect the size of the current font. But I'm not using LaTeX.

Can this be done in a straightforward way without oodles of modifications to Plain TeX?

-

I'd use a completely different approach:

\input eplain
\beginpackages
\usepackage{graphicx}
\endpackages

\def\smallampersand{\scalebox{.8}{\&}}
\def\VandV{V\kern-.4ex\smallampersand\kern-.4ex V}

\font\my="Linux Libertine O" at 36pt

\my\VandV


Note that for a logo \kern should be used, or an \hbox around the construction, as \hskip introduces a break point.

-
This is the right way to do what I want to do (the V&V logo). Thanks! – EfForEffort Feb 28 '12 at 2:43

I have a similar approach to @morbusg's: examine the \fontname. The following code retrieves the current font name and its size/scaling factor, then modifies the latter and declares a temporary font with the new size. The font is scaled by 1.2 in both directions. As a result the macro can be used recursively to get relatively bigger/smaller sizes. The font manipulation is done in a group to not accumulate the computational error.

\newcount\fontscale
\newdimen\fontsize

\def\processfont#1 #2#3 #4 {%
\def\fname{#1}%
% Can't normally compare to 'at' here, because \fontname returns
% characters of catcode 12
\if a#2%
\fontsize=#4
\else
\fontscale=#4
\fi
\def\scalefont#1#2#3{%
\begingroup
\edef\x{\fontname\font\space scaled 1000 \relax}%
\fontscale=0
\expandafter\processfont\x
\ifnum\fontscale=0
% We have the "at" syntax
\multiply\fontsize by #1
\divide\fontsize by #2
\font\tmpfont=\fname\space at \the\fontsize
\else
% We have the "scaled" syntax
\multiply\fontscale by #1
\divide\fontscale by #2
\font\tmpfont=\fname\space scaled \the\fontscale
\fi
\tmpfont #3%
\endgroup}
\def\smaller#1{\scalefont{5}{6}{#1}}
\def\bigger#1{\scalefont{6}{5}{#1}}

test \bigger{test \bigger{test \bigger{test}}}

test \smaller{test \smaller{test \smaller{test}}}

\bye


However, this approach can't use different optical font sizes, which are the key to finest typesetting. Accounting for the optical sizes would require infrastructure that needs to know the different available optical sizes of the particular font in use, much like LaTeX already does. Therefore you might achieve better results with LaTeX and, for example, the relsize package.

-

I had such a clever idea: to use the result of \fontname\font as the input for a macro which loads \dimexpred smaller font. But unfortunately it has issues (I used plain XeTeX):

\font\test="Myriad Pro" at 16pt
\test
\def\smaller{%