Difference between revisions of "Protrusion"

From Wiki
Jump to navigation Jump to search
m (lighter margins)
m (lighter margin)
Line 34: Line 34:
 
\setuptolerance[tolerant]
 
\setuptolerance[tolerant]
 
\setupbodyfont[postscript]
 
\setupbodyfont[postscript]
 +
\setupcolors[state=start]
 
\starttext
 
\starttext
\startframedtext[width=270pt,rightframe=on,frame=off,align=hanging,offset=none]
+
\startframedtext[width=270pt,rightframe=on,frame=off,align=hanging,offset=none,framecolor=middlegray]
 
\input tufte  
 
\input tufte  
 
\stopframedtext
 
\stopframedtext

Revision as of 14:43, 2 February 2006

< Fonts

Character protrusion is a somewhat subtle advanced typographic effect in which some characters (often punctuation) are moved partially or fully into the margin in order to give it an optically smoother appearance. In ConTeXt, this is achieved via the font mechanisms within pdfTeX. Much of the difficult work is done in some presets by Hans, but there are a few tricks needed in order to activate the feature.

This feature is also commonly called "Handling" after the font handling feature that enables it, and "Hanging" after what hyphens do into the margin. The microtype LaTeX package also includes a protrusion feature, and may be known by that name to a certain audience.

Font handling is documented in the Fonts in ConTeXt manual.

Demo

The simplest way to illustrate it is with a quick demo:

\usetypescript[postscript][ec]
\usetypescript[adobekb][ec]
\usetypescript[serif][hanging][normal]  % this creates the 'handling' synonyms
\setupalign[hanging]                    % this actually triggers the feature

The first two lines switch the font (see below for Latin Modern), and the second two lines actually activate the feature.

\setupbodyfont[postscript]
\starttext
\input tufte 
\stoptext

Switch the font that we setup, and show an example with lots of punctuation. The illustration has normal hanging enabled:

Details

The \usetypescript command has three arguments above and there are different possible values for each:

\usetypescript [family] [trigger] [type]
family serif, sans, or mono
trigger handling, hanging, or hz (makes no difference--it's just a trigger)
type pure full protrusion of only selected punctuation
normal partial protrusion of punctuation and some asymmetrical letters
hz variable correction of character widths
quality combination of hz and pure

Use with Latin Modern

Because ConTeXt pre-loads its default Latin Modern font, it is a little tricky to get it to work right. Here is one solution, where you setup the hanging, load an alternative latin-modern typescript, and then reset the defaults:

\usetypescript[serif,sans,mono][hanging][pure]
\setupalign[hanging] 
\usetypescript[modern-base][texnansi]  % a simplified latin-modern typescript
\setupbodyfont[reset]
\setupbodyfont[modern]

The illustration has pure hanging enabled: