Changes

Jump to navigation Jump to search
3,443 bytes added ,  14:26, 2 February 2006
Protrusion aka hanging aka font handling
< [[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 [[article:89|Fonts in ConTeXt]] manual.

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

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

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

<texcode>
\setupbodyfont[postscript]
\starttext
\input tufte
\stoptext
</texcode>

Switch the font that we setup, and show an example with lots of punctuation. The illustration has '''normal''' hanging enabled:
<context>
\usetypescript[postscript][ec]
\usetypescript[adobekb][ec]
\usetypescript[serif][hanging][normal] % this creates the 'handling' synonyms
\setupalign[hanging] % this actually triggers the feature
\setuptolerance[tolerant]
\setupbodyfont[postscript]
\starttext
\startframedtext[width=270pt,rightframe=on,frame=off,align=hanging,offset=none]
\input tufte
\stopframedtext
\stoptext
</context>

== Details ==

The [[cmd:usetypescript|\usetypescript]] command has three arguments above and there are different possible values for each:
\usetypescript [''family''] [''trigger''] [''type'']
{| border="1" cellspacing="0"
| ''family''
| colspan="2" | '''serif''', '''sans''', or '''mono'''
|-
| ''trigger''
| colspan="2" | '''handling''', '''hanging''', or '''hz''' (makes no difference--it's just a trigger)
|-
| rowspan="4" | ''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:

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

The illustration has '''pure''' hanging enabled:
<context>
\usetypescript[serif][hanging][pure] % this creates the 'handling' synonyms
\setupalign[hanging] % this actually triggers the feature
\usetypescript[modern-base][texnansi]
\setupbodyfont[reset]
\setupbodyfont[modern]
\starttext
\startframedtext[width=270pt,rightframe=on,frame=off,align=hanging,offset=none]
\input tufte
\stopframedtext
\stoptext
</context>

Navigation menu