

\newdimen \naturalwidth
\newdimen \naturaldepth
\newdimen \naturalheight

\chardef \atcode = \the \catcode `\@
\catcode `\@ = 11

\newbox \l@tterspacebox
\newtoks \l@tterspacetoks

\let \@x = \expandafter

\def \letterspace #1#%
    {\def \hb@xmodifier {#1}%
     \afterassignment \l@tterspace
     \l@tterspacetoks =
    }

\def \l@tterspace 
    {\setbox \l@tterspacebox = \hbox {\the \l@tterspacetoks}%
     \naturalwidth =  \wd \l@tterspacebox
     \naturaldepth =  \dp \l@tterspacebox
     \naturalheight = \ht \l@tterspacebox
     \hbox \hb@xmodifier 
        {\@x \l@tt@rspace \@x {\@x }\the \l@tterspacetoks \@nd}%
    }

\def \l@tt@rspace #1#2\@nd
    {\def \1{#1}%
     \def \2{#2}%
     \1%
     \ifx \1\empty \else \ifx \2\empty \else \hss \fi \fi
     \ifx \2\empty
          \let \n@xt = \relax
     \else
          \futurelet \2\m@kespaceexplicit #2\@nd
          \ifx \1\space \hss \fi
          \def \n@xt {\expandafter \l@tt@rspace \2\@nd}%
     \fi
     \n@xt
    }

\def \m@kespaceexplicit #1#2\@nd {\if \2 \def \2{{ }#1#2}\else \def \2{#1#2}\fi}

\catcode `\@ = \the \atcode

%%% Examples

%%% \letterspace {Now is the time for all good men}
%%% \letterspace to \hsize {Now is the time for all good men}
%%% \letterspace spread 0.3 \hsize {Now is the time for all good men}
%%% \letterspace to 1.5 \naturalwidth {Now is the time for all good men}
%%% \letterspace spread 0.5 \naturalwidth {Now is the time for all good men}

%%% \end
