%%% The user needs to be able to specify the width for text, and
%%% use the largest point size necessary to fill that width.
%%%
%%% After macros by Phil Taylor January 1993; 
%%% converted to LaTeX style file (needs NFSS) and changed syntax 
%%% by Sebastian Rahtz, February 1993.

%%% \Fontname: like \fontname, but voids any size specifier
%%%  Usage:   \Fontname \font {} %%% don't omit {} !!!

\edef \Fontname 
     {\noexpand \expandafter \noexpand \stripsize \noexpand \fontname \space}
\def \stripsize #1 #2#{#1}

\newcount \pts@f@r
\newdimen \set@width

\def\massage@fontname#1 #2:{\def\curr@fontname{#1}}

\def \scaletowidth#1#2{%
    \set@width #1 
    \edef\f@name{\fontname\font\space:}%
    \expandafter\massage@fontname\f@name
    \pts@f@r \f@size
    \setbox 0 = \hbox{#2}%
     \ifdim \wd 0 < \set@width
	\def\@increment{1}%
	\def\@test{<}%
     \else
	\def\@increment{-1}%
	\def\@test{>}%
     \fi
     \loop
       \font\temp@font=\curr@fontname\space at \the\pts@f@r pt
	\setbox 0 = \hbox{{\temp@font #2}}%
        \message {\curr@fontname->\the \pts@f@r...}%
        \ifdim \wd 0 \@test \set@width
           \advance \pts@f@r by \@increment
     \repeat
     \advance \pts@f@r by -\@increment
     \message {The calculated font size is \the \pts@f@r pt}%
     \font\temp@font=\curr@fontname\space at \the\pts@f@r pt
     \hbox to \set@width {\hss{\temp@font #2}\hss}%
    }
\endinput


Example:

\scaletowidth{50cm}{Now is the time for the Party}
