From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43212 Path: news.gmane.org!not-for-mail From: "Charles P. Schaum" Newsgroups: gmane.comp.tex.context Subject: Intraword spacing proof of concept Date: Thu, 14 Aug 2008 16:24:37 -0500 Message-ID: <1218749078.12095.30.camel@elbereth> References: <20080813210743.GA21092@phare.normalesup.org> <115224fb0808140058i4d85aaf9t5e02c2787ff4611c@mail.gmail.com> <1jma8p9cgq57.dlg@nililand.de> <115224fb0808140244jac3bda9gc93c6dd8aa8e183c@mail.gmail.com> <1jd1l5yycmkgu.dlg@nililand.de> <20080814134954.GE21092@phare.normalesup.org> <48A490AE.4020200@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218749279 12479 80.91.229.12 (14 Aug 2008 21:27:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2008 21:27:59 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Aug 14 23:28:50 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1KTkNC-0001NJ-6d for gctc-ntg-context-518@m.gmane.org; Thu, 14 Aug 2008 23:28:46 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9345F1FEB9; Thu, 14 Aug 2008 23:27:46 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 22058-03-2; Thu, 14 Aug 2008 23:26:52 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 15B451FE9F; Thu, 14 Aug 2008 23:26:52 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 00EA41FE86 for ; Thu, 14 Aug 2008 23:26:48 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 22063-02 for ; Thu, 14 Aug 2008 23:25:53 +0200 (CEST) Original-Received: from smtp109.sbc.mail.mud.yahoo.com (smtp109.sbc.mail.mud.yahoo.com [68.142.198.208]) by ronja.ntg.nl (Postfix) with SMTP id 711581FE7E for ; Thu, 14 Aug 2008 23:24:37 +0200 (CEST) Original-Received: (qmail 31030 invoked from network); 14 Aug 2008 21:24:36 -0000 Original-Received: from unknown (HELO ?192.168.1.103?) (verbo.solo@sbcglobal.net@69.153.246.71 with plain) by smtp109.sbc.mail.mud.yahoo.com with SMTP; 14 Aug 2008 21:24:36 -0000 X-YMail-OSG: oPQdIMYVM1mVzIzHU7aiQP1Gh0EMFYNgn1.9bv.NRWN.PPV1BUvus3okHtHo_kMmuLBhycZOHOxmct3l9gLKCZHSMpoiwUxqzlGJ2WoY3Vn9mGALtEcdiHakhb4PtaXmoJI- X-Yahoo-Newman-Property: ymail-3 In-Reply-To: <48A490AE.4020200@wxs.nl> X-Mailer: Evolution 2.22.3.1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:43212 Archived-At: 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$$} {\catcode`@=11 \gdef\PackText#1{\@TextPack#1\@end} \gdef\@TextPack#1{\ifx#1\@end \let\next=\relax \else \let\next= \@TextPack#1\fi \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 ___________________________________________________________________________________