Hi Folks, I wanted to confirm that Hans is **Correct** about font fitting. In fact, I think that scaling is superior. One thing I did find is that one must go real easy with the scaling, e.g., compute the difference between the size you want/need, and see that it isn't too great, as the test shows. This test suite, written for plain, nevertheless will work in ConText IF you set the conditional value \havecontexttrue, which I did below. Some of the exact font results will, however, differ between the two. That was just my not trying to rectify differences in the default fonts and sizes. I found this exercise to be fun for learning about macro expansion, as well as dealing with multiple constraints and tail recursion. Charles ----Cut Here----- %Testing insertion of kerns and stuff \newif\ifhavecontext %\havecontextfalse \havecontexttrue % Here we have two kerns that are equally smaller and larger \newdimen\KernSmall \newdimen\KernLarge \KernSmall=-0.033333em \KernLarge=0.033333em % This is Knuth's length macro from the \Tex Book \def\length#1{\count30=0 \getlength#1\end \number\count30} \def\getlength#1{\ifx#1\end \let\next=\relax \else\advance\count30 by1 \let\next=\getlength\fi \next} % This is a modified version of the length macro. % It's existence is to stuff kerns between any two internal tokens. \newcount\intraword \newdimen\intrakern {\catcode`@=11 \gdef\InsertKern#1#2{\intraword=0\intrakern=#1\@ppend#2\end} \gdef\@ppend#1{\ifx#1\end \def\insertium{}\else \def\insertium{\kern \intrakern}\fi \ifnum\intraword>0\insertium\fi \ifx#1\end \let\next= \relax\else\advance\intraword by1\let\next=\@ppend#1\fi\next}} % But who says you have to use only kerns? {\catcode`@=11 \gdef\InsertStuff#1#2{\intraword=0\gdef\StickIt{#1}\@ppendstuff#2\end} \gdef\@ppendstuff#1{\ifx#1\end \def\insertium{}\else \def \insertium{\StickIt}\fi \ifnum\intraword>0\insertium\fi \ifx#1\end \let \next=\relax\else\advance\intraword by1\let\next=\@ppendstuff#1\fi \next}} % SDF-1 will control the scaled box to equal the negative kerning \newdimen\SDFONE \newdimen\fitdimone \newdimen\fitdimtwo \def\fitbox#1{% \setbox30=\hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}} \SDFONE=\wd30 \font\custfont=cmr10 scaled 1000 \setbox30=\hbox{\custfont#1} \fitdimone=\SDFONE \fitdimtwo=\wd30 \divide\fitdimtwo by 1000 \divide\fitdimone\fitdimtwo \count30=\fitdimone \font\custfont=cmr10 scaled \count30 \hbox{\custfont#1} } % Okay, and this is what it all comes to\dots \ifhavecontext\starttext\fi \fitbox{OK, Class\dots}\par \bigskip Garbage in, garbage out.\par Ignore spaces and get Knuth's count of \length{Garbage in, garbage out.}.\par Count spaces and get Knuth's count of \length{Garbage\ in,\ garbage\ out.}.\par \smallskip This includes punctuation.\par \bigskip Here you can see the insertion points of the macro.\par \InsertStuff{$_\wedge$}{Garbage\ in,\ garbage\ out.} \medskip Hungry? Want {\bf \InsertStuff{$^{Snacks}$}{Food}}? \medskip Warning! You can put funky stuff in the insertium, but not in the text.\par If you do that, \TeX\ will either produce an error or give you strange results. \bigskip \newdimen\compn \newdimen\comps \newdimen\compl Inserting kerns does have an effect:\par \smallskip Length of ``Garbage in, garbage out'' is \setbox30=\hbox{Garbage in, garbage out}\the\wd30 \compn=\wd30\par Length of ``\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out}'' is \setbox30=\hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out}} \the\wd30 \comps=\wd30\par Length of ``\InsertKern{\KernLarge}{Garbage\ in,\ garbage\ out}'' is \setbox30=\hbox{\InsertKern{\KernLarge}{Garbage\ in,\ garbage\ out}} \the\wd30 \compl=\wd30\par \bigskip Size matters\dots \smallskip {\tt N:} Garbage in, garbage out.\par {\tt S:} {\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}\par {\tt L:} {\InsertKern{\KernLarge}{Garbage\ in,\ garbage\ out.}\par \bigskip Which looks better? Scaled \the\KernSmall \smallskip Negative kern insertion (top) vs. font scaling (bottom):\par \ \ \ \hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}}\par \ \fitbox{Garbage in, garbage out.} \bigskip I had in mind something a little more radical\dots \KernSmall=-0.066667em \ Scaled \the\KernSmall \smallskip Negative kern insertion (top) vs. font scaling (bottom):\par \ \ \ \hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}}\par \ \fitbox{Garbage in, garbage out.} \bigskip This is just sick\dots\par \KernSmall=-0.1em Scaled \the\KernSmall \smallskip Negative kern insertion (top) vs. font scaling (bottom):\par \ \ \ \hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}}\par \ \fitbox{Garbage in, garbage out.} \smallskip \KernSmall=-0.2em Scaled \the\KernSmall \smallskip Negative kern insertion (top) vs. font scaling (bottom):\par \ \ \ \hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}}\par \ \fitbox{Garbage in, garbage out.} \smallskip \KernSmall=-0.3em Scaled \the\KernSmall \smallskip Negative kern insertion (top) vs. font scaling (bottom):\par \ \ \ \hbox{\InsertKern{\KernSmall}{Garbage\ in,\ garbage\ out.}}\par \ \fitbox{Garbage in, garbage out.} \ifhavecontext\stoptext\else\bye\fi