From b5920b2493c964f0aef2ebac0b37a42122b10207 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <megas.kapaneus@gmail.com>
Date: Thu, 17 Mar 2011 18:35:40 +0100
Subject: man: setup and define letterspacing macros

---
 letterspace.tex | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 153 insertions(+), 16 deletions(-)

(limited to 'letterspace.tex')

diff --git a/letterspace.tex b/letterspace.tex
index 6e80459..0e9d472 100644
--- a/letterspace.tex
+++ b/letterspace.tex
@@ -2,28 +2,35 @@
 
 \defineletterspace [largecaps]
 \setupletterspace  [largecaps] [
-  spacefactor=.2,
+  factor=.2,
   spaceskip=.3em,
   suppresskern=yes,
 ]
 
 \defineletterspace [mediumcaps]
 \setupletterspace  [mediumcaps] [
-  spacefactor=.25,
+  factor=.25,
   spaceskip=.5em,
   suppresskern=yes,
 ]
 
 \defineletterspace [smallcaps]
 \setupletterspace  [smallcaps] [
-  spacefactor=.05,
+  factor=.05,
   spaceskip=.25em,
-  suppresskern=no,
+  suppresskern=yes,
 ]
 
 \defineletterspace [textemph]
 \setupletterspace  [textemph] [
-  spacefactor=.125,
+  factor=.125,
+  spaceskip=.33em,
+  suppresskern=no,
+]
+
+\defineletterspace [slightly]
+\setupletterspace  [slightly] [
+  factor=.075,
   spaceskip=.33em,
   suppresskern=no,
 ]
@@ -33,7 +40,7 @@
 
 \defineletterspace [ugly]
 \setupletterspace  [ugly] [
-  spacefactor=.4,
+  factor=.4,
   spaceskip=1em,
   suppresskern=no,
 ]
@@ -51,8 +58,11 @@
   onum=yes,
   dlig=yes,
   liga=yes,
+  kern=yes,
 ]
 
+\definefontfeature [kerning] [kern=yes]%
+
 \usetypescript [modern]
 \usetypescript [antykwa-poltawskiego]
 \setupbodyfont [antykwa-poltawskiego,10pt]
@@ -173,9 +183,9 @@
 \defineletterspace [LSchapter]
 \defineletterspace [LSsection]
 \defineletterspace [LSsubsection]
-\setupletterspace  [LSchapter]    [spacefactor=.1,  spaceskip=.33em]
-\setupletterspace  [LSsection]    [spacefactor=.15, spaceskip=.40em]
-\setupletterspace  [LSsubsection] [spacefactor=.125,spaceskip=.33em]
+\setupletterspace  [LSchapter]    [factor=.1,  spaceskip=.33em]
+\setupletterspace  [LSsection]    [factor=.15, spaceskip=.40em]
+\setupletterspace  [LSsubsection] [factor=.125,spaceskip=.33em]
 
 \def   \fontchapter#1{\setupbodyfont[11pt]\WORD\LSchapter{#1}}
 \def   \fontsection#1{\setupbodyfont[11pt]\word\sc\LSsection{#1}}
@@ -225,7 +235,8 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \def   \tocfontchapter#1{\WORD\LSchapter{#1}}
-\def   \tocfontsection#1{\word\sc\LSsection{#1}}
+%\def   \tocfontsection#1{\word\sc\LSsection{#1}}
+\def   \tocfontsection#1{\slightly{#1}}
 \def\tocfontsubsection#1{\LSsubsection{#1}}
 
 \setuplist [chapter] [
@@ -367,6 +378,9 @@
 
 \setupindenting [yes,next,medium]
 
+\useURL [leibnizausgabe] [http://www.leibniz-edition.de/Baende/] [] [Leibniz-Edition]
+\useURL [soulpackage] [http://ctan.larsko.net/macros/latex/contrib/soul/] [] [soul]
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Makeup for Front Matter                                       %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -446,17 +460,123 @@ This module is partly a reaction on the excellent article the
 last quotation was taken from, and partly the endeavour of a
 convinced \CONTEXT\ user and letter spacer to replace a number of
 kludges already in use with something more consistent.
+To be sure, those warnings are grounded in facts and they should
+seriously be taken into account before one resorts to
+letterspacing.
+
+Before the advent of \LUATEX\ the implementation of proper letter
+spacing in *\TEX\ proved to be extremely difficult.
+For instance, the \from [soulpackage] package provides some means
+but at the same time severely limits the content passed to
+macros.
+Nevertheless there are magnificent examples of letterspacing done
+right, like the \from [leibnizausgabe] by the Leibniz-Archiv in
+Hanover that has been typeset with \smallcaps{EDMAC} and \PDFTEX.
+Nowadays the Lua node library removes the technical restrictions
+and thus leaves the task of correct letterspacing to the user.
+The \te{Letterspace} module for \CONTEXT\ was designed to collect
+everything necessary to achieve this and to make it accessible
+from one place.
 
 \chapter{Commands}
 
+Technically, the \te{Letterspace} module doesn’t do anything
+fancy; it just maps some existing \CONTEXT\ macros into a single
+setup and lets you define and configure your own derivatives of
+it.
+The module is supposed to be loaded the regular way: somewhere
+before \type{\starttext} should be the line
+\starttyping
+\usemodule [letterspace]
+\stoptyping
+\noindentation-- That’s all.
+
 \section{Default Letterspace Command}
+Initially one letterspace command is already defined and
+configured, as well as a letterspacing environment.
+They are now ready for use in running text.
+
+%\definecolor [prettyone]   [r=.6,g=.6,b=.6]  % red
+%\definecolor [prettytwo]   [r=.0,g=.6,b=.6]  % green
+%\definecolor [prettythree] [r=.6,g=.6,b=.6]  % blue
+%\definecolor [prettyfour]  [r=.6,g=.6,b=.6]  % yellow
+
+%\startTEX
+\starttyping
+\usemodule [letterspace]
+\starttext
+
+\startlines
+  uides ut \letterspace{alta} stet \letterspace{niue} candidum
+  Soracte
+\stoplines
+
+\startletterspace
+  \startlines
+    hac {\italic ait} in Thebas, hac me iubet ardua uirtus
+    ire, Menoeceo qua lubrica sanguine turris.
+    experiar quid sacra iuuent, an falsus Apollo.
+  \stoplines
+\stopletterspace
+
+\stoptext
+\stoptyping
+%\stopTEX
 
 \showsetup{letterspace}
 \showsetup{startletterspace}
 
 \section{Defining and Customizing Letterspace Commands}
 
+The \te{Letterspace} module allows the letterspacing to be
+adjusted via \te{three} parameters.
+The \type{factor} determines the value by which the
+\te{intra}word spacing (between letters) will be extended.
+\type{spaceskip} specifies a dimension for the \te{inter}word
+spacing and, if applicable, the surrounding spaces.
+\type{suppresskern} allows for disabling the letter kerning which
+can improve the spacing of capitals (see below,
+\at{p.}[suppresskern]).
+
+The following lines reconfigure the predefined
+\type{\letterspace} macro to behave in an extreme fashion.
+\starttyping
+\setupletterspace [
+  factor=2,       % default: 0.125
+  spaceskip=2em,  % default: 0.5em
+]
+
+\letterspace{vapula!}
+\stoptyping
 \showsetup{setupletterspace}
+
+The recommended alternative to constantly readjusting the base
+command is to define separate macros for different purposes.
+
+\starttyping
+\defineletterspace [LSbighead]
+\defineletterspace [LSemphasis]
+\defineletterspace [LSsmcp]
+
+\setupletterspace [LSbighead]  [factor=.2,   spaceskip=.7em, suppresskern=yes]
+\setupletterspace [LSemphasis] [factor=.111, spaceskip=.4em, suppresskern=no,]
+\setupletterspace [LSsmcp]     [factor=.06,  spaceskip=.4em, suppresskern=no,]
+
+\LSbighead{\bf\WORD This is a candidate for sectioning, innit?}
+\blank [line]
+
+\startlines
+  terrarum delicta nec exsaturabile \LSsmcp{\sc Diris}
+  \LSemphasis{ingenium mortale} queror, quonam usque nocentum
+  exigar in poenas! taedet saeuire corusco
+  fulmine.
+\stoplines
+\stoptyping
+
+These macros can subsequently accessed from whatever markup
+element requires letterspacing: section titles, front matter
+makeup, emphasis etc.
+
 \showsetup{defineletterspace}
 
 \chapter{Applications}
@@ -573,7 +693,7 @@ It follows, that in the foregoing mapping, parts of longer
 However, substituting rule {\it2} for {\it3}, the resulting
 mapping will be less satisfactory.
 As quotations are prone to extending over multiple lines, whereas
-normal emphasis rarely spans more than two words, letter spacing
+normal emphasis rarely spans more than two words, spacing out
 the former might lead to the unbalanced appearance of paragraphs.
 So best avoid letterspacing in cases where the object possibly
 encompasses entire sentences.
@@ -594,17 +714,17 @@ good: \te{O Tite,} tute, \te{Tati,} tibi tanta, \te{tyranne,} tulisti.)
 \section{Capital Spacing}
 \startbuffer [display:capitals]
   \start%
-  \setupbodyfont [modern,12pt]%
+  %\setupbodyfont [modern,11pt]%
+  \setupbodyfont [11pt]%
   \framed[
     align=middle,
     background=color,
-    backgroundcolor=gray:1,
+    backgroundcolor=gray:2,
     offset=1em,
     frame=off,
   ]{%
-      \def\teststring{pavaway}%
+      \def\teststring{mispavayatsim}%
       %\definefontfeature [capitals] [cpsp=yes,kern=yes]% how’s this supposed to work?
-      \definefontfeature [kerning] [kern=yes]%
       \bf%
       {\color[gray:7]\WORD\teststring}\par
       %{\setff{capitals}\WORD\teststring}\par % why doesn’t this have
@@ -616,7 +736,7 @@ good: \te{O Tite,} tute, \te{Tati,} tibi tanta, \te{tyranne,} tulisti.)
 \stopbuffer
 
 \starthangaround{\getbuffer [display:capitals]}
-Another natural use of letter spacing is to even out capitals and
+Another natural use of letter spacing is to space out capitals and
 small caps, whose legibility suffers with increasing markup
 length.
 The appearance of capitals can be influenced in various ways, as
@@ -629,6 +749,23 @@ The final row, as the second, lacks kerning and adds
 20\,\letterpercent\ letter spacing.
 \stophangaround
 
+As is apparent from the example, the difference in spacing
+particularly influences the outcome.
+The {\WORD unmodified text} in the first row is packed too
+tightly, whereas disabling the kerning results in irregular
+widening of the {\subff{kerning}\WORD previously kerned} letters
+near the center.
+In the third row the sequence looks much better because of
+additional \mediumcaps{\WORD letterspacing.}
+With some fonts \smallcaps{\sc small capitals} profit from additional
+spacing as well, as employed in the section headings of this
+document.\reference[suppresskern]{}
+The \te{Letterspace} module provides a switch \type{suppresskern}
+that, if set to {\it yes}, will disable kerning during
+letterspacing.
+This option is meant for the special treatment of capitalization
+but depending on the font it might equally help when dealing with
+emphasis as well.
 
 \title{References}
 
-- 
cgit v1.2.3

