Hi all,

Quite a while ago I mentioned letter spacing, or the normal absence
thereof, in TeX and friends. True, you could skin this cat by
mathematically scaling the text (font size) by steps to fit the box ---
the code is out there. But that was not the only way, thought I. Some
programs also call this general idea tracking, that is, inserting
positive or negative kerns independent of the \spacingfactor.

Just for grins I nabbed two snippets from, respectively, manmac.tex and
texbook.tex. I then added a bit of my own hackery that was inspired by
DEK's length macro. I realized that a non-counting version of the length
macro was a memory-friendly way to insert a symbol between any two
others in a given sequence. What I wanted to insert was a negative kern.

The negative kern must be small, less than \negthinspace, or else you
start getting weird effects like a practically chiastic ordering of
letters, and certainly a chaotic one. The smallest that one dare go
seems to be -.066667em, the point where the serifs can start running
together. Using -.033333em really does not show any letters running
together, yet it still saves space. I got those figures as suggested by
Knuth's own selections for tightness in the interword spacing.

And yes, you could theoretically space out the letters, like the soul
package that does proper Sperrdruck. One major drawback with my kludge
is the need to use control spaces, else all spaces evaporate. If soul
were ported to ConTeXt, and it seems like the code might allow that,
then a version that "spaces in" and "spaces out" could well be possible.

So here's the proof of concept, for those so interested.

Charles

\starttext
% macros for non-centered displays
\outer\def\begindisplay{\obeylines\startdisplay}
{\obeylines\gdef\startdisplay#1
  {\catcode`\^^M=5$$#1\halign\bgroup\indent##\hfil&&\qquad##\hfil\cr}}
\outer\def\enddisplay{\crcr\egroup$$}

[EMAIL PROTECTED]
[EMAIL PROTECTED]@end}
[EMAIL PROTECTED]@end \let\next=\relax \else \let\next=
[EMAIL PROTECTED] \kern-0.066667em\next}}

\PackText{pack}\par
\PackText{packity\ pack\ pack}\thinspace.

\begindisplay \hbadness10000
\hbox spread-.666667em{The badness of this line is 100.}&
  \quad(very tight)\cr
\hbox spread-.666667em{\PackText{The\ badness\ of\ this\ line\ is\
100}\thinspace.}&
  \quad(\PackText{So\ baaaad}\thinspace!)\cr
\hbox spread-.333333em{The badness of this line is 12.}&
  \quad(somewhat tight)\cr
\hbox{The badness of this line is 0.}&
  \quad(perfect)\cr
\hbox spread.5em{The badness of this line is 12.}&
  \quad(somewhat loose)\cr
%\hbox spread 1em{The badness of this line is 100.}&
% \quad(loose)\cr % then "looser"
\hbox spread 1.259921em{The badness of this line is 200.}&
  \quad(loose)\cr
%\hbox spread 1.713em{The badness of this line is 500.}&
% \quad(bad)\cr % then "worse"
\hbox spread 2.155em{The badness of this line is 1000.}&
  \quad(bad)\cr
\hbox spread 3.684em{The badness of this line is 5000.}& % actually
4995!
  \quad(awful)\cr
\enddisplay
\stoptext


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to