.\" Sccsid @(#)doc.tr	2.22 (gritter) 10/24/06
.do xflag 3
.warn
.spreadwarn 5p
.lc_ctype de_DE.utf8
.mediasize a5
.hylang en_US
.hw Post-Script work-around
.if t .so fonts.tmac \" Generated by makefile
.ie r GaramondPremrPro \{\
.	\" Use Garamond Premier Pro font
.	ds FT Garamond Premier Pro
.	fp 1 R GaramondPremrPro-Med otf
.	fp 2 I GaramondPremrPro-MedIt otf
.	fp 0 N GaramondPremrPro-Med otf
.	fp 0 C GaramondPremrPro-Med otf
.	fp 0 SC GaramondPremrPro-Med otf
.	fp 0 T GaramondPremrPro-Subh otf
.	kernpair T F T F 25
.	kernpair SC R SC \[i.sc] 40
.	flig R ft \[f_t.alt]
.	ds Ornament \v'-.25m'\s9\[orn.01]\s0
.	feature R +pnum +onum
.	feature I +pnum +onum
.	feature SC +smcp +pnum +onum
.	ftr R Q\[Q.alt]
.	ftr I Q\[Q.swash]
.	\".ftr C Q\[Q.alt]
.	ftr SC Q\[Q.alt]
.	ftr T Q\[Q.alt]
.	flig SC 0
.	flig T 0
.	flig C 0
.	fzoom C .92
.	track R 1 .2 18 0
.	track N 1 .2 18 0
.	track I 1 .2 18 0
.	track C 1 1.2 40 0
.	track SC 1 1.2 40 0
.	track T 1 1.2 40 0
.	kernbefore R ; 66 : 66 ! 66 ? 66
.	kernbefore I ; 66 : 66 ! 66 ? 66
.	kernbefore R › 40 / 66
.	kernafter R ‹ 40 / 66
.	kernpair R f R i 25
.	kernpair R f R l 100
.	kernpair R f R b 110
.	kernpair R f R k 110
.	kernpair R ' R ' 0
.	kernpair R ` R ` 0
.	kernpair R f R R 100
.	kernpair R f R P 100
.	kernpair N f N i 25
.	kernpair N f N l 100
.	kernpair N f N b 110
.	kernpair N ' N ' 0
.	kernpair N ` N ` 0
.	kernpair N f N R 100
.	kernpair N f N P 100
.	kernpair N g N _ 60
.	kernpair N f N 8 20
.	kernpair N ſ N ſ 40
.	kernpair N ſ N i 85
.	kernpair I ' I ' 0
.	kernpair I ` I ` 0
.	kernpair C F C F 45
.\}
.el \{\
.	\" Use libertine font
.	ds FT Linux Libertine
.	fp 1 R LinLibertine_R otf \" Roman
.	fp 2 I LinLibertine_RI otf \" Italic
.	fp 0 N LinLibertine_M otf \" Monospace
.	fp 0 C LinLibertine_R otf \" Capital in text
.	fp 0 SC LinLibertine_R otf \" Small capitals
.	fp 0 T LinLibertine_DR otf \" Titling
.	fp 0 U LinLibertine_R otf \" Superscript
.	fzoom N .8
.	fzoom C .9
.	flig R `` \[quotedblleft]
.	flig R '' \[quotedblright]
.	flig R fb \[f_b] ff \[f_f]
.	flig R fh \[f_h] ffh \[f_f_h]
.	flig R fi \[fi] ffi \[f_f_i]
.	flig R fj \[f_j] ffj \[f_f_j]
.	flig R fk \[f_k] ffk \[f_f_k]
.	flig R fl \[fl] ffl \[f_f_l]
.	flig R ft \[f_t] fft \[f_f_t]
.	flig R tt \[t_t]
.	flig I `` \[quotedblleft]
.	flig I '' \[quotedblright]
.	flig I fb \[f_b] ff \[f_f]
.	flig I fh \[f_h] ffh \[f_f_h]
.	flig I fi \[fi] ffi \[f_f_i]
.	flig I fj \[f_j] ffj \[f_f_j]
.	flig I fk \[f_k] ffk \[f_f_k]
.	flig I fl \[fl] ffl \[f_f_l]
.	flig I ft \[f_t] fft \[f_f_t]
.	flig I tt \[t_t]
.	flig B `` \[quotedblleft]
.	flig B '' \[quotedblright]
.	flig B fb \[f_b] ff \[f_f]
.	flig B fh \[f_h] ffh \[f_f_h]
.	flig B fi \[fi] ffi \[f_f_i]
.	flig B fj \[f_j] ffj \[f_f_j]
.	flig B fk \[f_k] ffk \[f_f_k]
.	flig B fl \[fl] ffl \[f_f_l]
.	flig B ft \[f_t] fft \[f_f_t]
.	flig B tt \[t_t]
.	flig C 0
.	flig T fb \[f_b] ff \[f_f]
.	flig T fh \[f_h] ffh \[f_f_h]
.	flig T fi \[fi] ffi \[f_f_i]
.	flig T fj \[f_j] ffj \[f_f_j]
.	flig T fk \[f_k] ffk \[f_f_k]
.	flig T fl \[fl] ffl \[f_f_l]
.	flig T ft \[f_t] fft \[f_f_t]
.	flig T tt \[t_t]
.	feature R +pnum +onum
.	feature I +pnum +onum
.	feature SC +smcp +pnum +onum
.	feature U +sups
.	track SC 1 1.2 40 0
.	track C 1 1.2 40 0
.	track N 1 -.1 40 -0
.	kernbefore R ; 66 : 66 ! 66 ? 66
.	kernbefore I ; 66 : 66 ! 66 ? 66
.	kernafter R ( 66
.	kernbefore R ( 66
.	kernafter R \[quotedblleft] 100
.	kernafter I \[quotedblleft] 100
.	kernbefore R \[quotedblright] 100
.	kernbefore I \[quotedblright] 100
.	kernafter N \[longs] -190
.	kernbefore N \[backslash] -100
.	kernafter N \[backslash] -100
.	kernpair R 0 R / 50
.	kernpair R / R 1 -90
.	kernpair R 1 R / 40
.	kernpair R / R 2 -80
.	char \(ff \[f_f]
.	char \(Fi \[fi]
.	char \(Fl \[fl]
.	char \[s_p] sp
.	ds Ornament \v'-.25m'\s9\[uniE002]
.\}
.if r GillSansStd \{\
.	fp 0 GI GillSansStd otf
.	fzoom GI .94
.\}
.
.nr TM 1.75c+1v
.nr EM 2.65c
.nr OM 1.7c
.nr AH 14.8c
.nr PE \n(TMu+\n(AHu
.nr LL 10.4c
.nr PS 10p
.nr VS 12p
.ll \n(LLu
.ss 12 0
.minss 9
.de Breakpage
.	ch Breakpage
'	bp
.	Newpage
..
.nr print-pageno 0
.ds pageno-style I
.ev pageno
.	evc 0
.ev
.de Newpage
.	ie e .po \\n(EMu
.	el .po \\n(OMu
.	nr pageno \\n%
.	af pageno \\*[pageno-style]
.	if \\n[print-pageno]>0 \{\
.		ev pageno
.			sp |\\n(PEu+2v
.			ie o .ad r
.			el .ad l
\\n[pageno]
.			br
.		ev
.	\}
.	ev pagelabel
\\X'PS: [ /Label (\\n[pageno]) /PAGELABEL pdfmark'
.		br
.	ev
.	wh \\n(PEu Breakpage
'	sp |\\n(TMu
.	ns
..
.de Bookmark
.	mk Btmp
.	ev bookmarks
.		ie \\n[Btmp]<=\\n(TM \{\
.			sp |0c
.			nr bmove 1v+4p
.		\}
.		el .nr bmove 1v
\v'-\\n[bmove]u'\\X'PDFMark: Bookmark 0 \\$1'
.		sp |\\n[Btmp]u
.	ev
..
.nr space 0
.de S
.	br
.	ne 4+\\n[space]
.	sp 1+\\n[space]
.	Bookmark "\\$1"
.	ft I
\\$1
.	ft R
.	sp
..
.de P
.	ti +1m
.	nr space 1
..
.de XS
.	\" Start example
.	sp
.	in +2m
.	lg 0
.	nf
.	ft N
.	minss 11
..
.de XE
.	\" Stop example
.	in -2m
.	lg
.	fi
.	sp
.	minss 9
.	ft R
.	nr space 0
..
.de XY
.	\" Start diversion
.	br
.	di ED
..
.de XZ
.	\" Stop diversion
.	br
.	di
.	rm ED
..
.\" Check which examples to print
.ie r GaramondPremrPro \{\
.	als EX XS
.	als EE XE
.	als LX XY
.	als LE XZ
.\}
.el \{\
.	als EX XY
.	als EE XZ
.	als LX XS
.	als LE XE
.\}
.de LP
.	\" Print example
.	ft R
.	\"ti 1m
\h'-\w'\[uni261E]\ 'u'\[uni261E]\ \\$*
.	ft N
..
.de TS
..
.de TE
..
.ds TR \fItroff\fP
.ds TR, \fItroff,\fP
.ds TR. \fItroff.\fP
.ds TR; \fItroff;\fP
.ds TR: \fItroff:\fP
.ds PS PostScript
.tr &.
\X'PDFMark: Author Gunnar Ritter'
\X'PDFMark: Title Font Handling in Troff With PostScript Devices'
\X'PS: [ {Catalog} << /ViewerPreferences << /DisplayDocTitle true >> >> /PUT pdfmark'
\X'PS: [ /PageMode /UseOutlines /DOCVIEW pdfmark'
\X'PS: [ {Catalog} << /PageLayout /TwoPageRight >> /PUT pdfmark'
.br
.Newpage
.ps \n(PSu
.vs \n(VSu
.ad c
Font Handling in Troff With PostScript Devices
.bp
\&
.bp
.Bookmark Title
.ps 18
.vs 24
.sp -7p
.ft T
.ad c
FONT HANDLING IN TROFF
.br
WITH POSTSCRIPT DEVICES
.sp 60p
.ps \n(PSu
.vs \n(VSu
.ft SC
Gunnar Ritter
.ft R
.sp
10/24/06
.sp 24p
\*[Ornament]
.sp |\n(PEu-1v
Heirloom Documentation Tools
.bp
.ad l
.di Impression
\[less]http\&:/\&/\&n-t-roff.github.io\&/\&heirloom\&/\&doctools.html\[greater]
.br
.di
\&
.pn 1
.ds pageno-style 1
.sp |\n(PEu-\n(dnu
.nf
.Impression
.fi
.bp
.ad p
.ft R
.S "The basics"
.nr print-pageno 1
.P
Heirloom \*(TR understands two ways to select \*(PS fonts.
.P
The current method can access \*(PS font files directly. Fonts are
selected using an extended ``.fp'' request.
As simple examples,
.EX
&fp 0 \fCAG\fN gdrg____ pfb
&ft \fCAG\fN
Here is some text in Adobe Garamond Regular.
.EE
.LX
&fp 0 R somefont pfb
&ft R
Here is some text in somefont.
.LP Here is some text in somefont.
.LE
.ie r GaramondPremrPro or
.el or, with the Linux Libertine font used in this document,
.EX
&fp 0 \fCAG\fN AGaramondPro-Regular otf
&ft \fCAG\fN
Here is some text in Adobe Garamond Pro Regular.
.EE
.LX
&fp 0 R LinLibertine_R otf
&ft R
Here is some text in Linux Libertine Regular.
.LP Here is some text in Linux Libertine Regular.
.LE
.P
But it is also possible to have different names for the metrics and
glyph data files, as in
.EX
&fp 0 \fCAM\fN mykerning.afm gdrg____.pfb
&ft \fCAM\fN
This text prints in Adobe Garamond using modified kerning.
.EE
.LX
&fp 0 R mykerning.afm somefont.pfb
&ft R
This text prints in somefont using modified kerning.
.LP This text prints in somefont using modified kerning.
.LE
.P
The default higher-resolution ``ps'' \*(PS device always uses
\fCAFM\fR files; it supports the conventional ``.fp'' request for backwards
compatibility to select pre-installed fonts from the \fCPDF\fR base set.
.P
With fonts selected by this method, localized input processing is
performed according to the \fCLC_CTYPE\fR environment variable, or according
to a document-specific value set by the ``.lc_ctype'' request:
.EX
&\[backslash]\[quotedbl] Enable long request names.
&do xflag 3
&\[backslash]\[quotedbl] de_\fCDE\fN.utf8 is for \fCGNU\fN libc; de_\fCDE\fN.\fCUTF\fN-8 works elsewhere.
&lc_ctype de_\fCDE\fN.utf8
Deutscher Text mit ‹Anführungszeichen›
&sp
The first five small letters of the Greek alphabet: α β γ δ ε
.EE
.LX
&\[backslash]\[quotedbl] Enable long request names.
&do xflag 3
&\[backslash]\[quotedbl] de_DE.utf8 is for GNU libc; de_DE.UTF-8 works elsewhere.
&lc_ctype de_DE.utf8
Deutscher Text mit ‹Anführungszeichen›
.LP Deutscher Text mit ‹Anführungszeichen›
&sp
The first five small letters of the Greek alphabet: α β γ δ ε
.LP The first five small letters of the Greek alphabet: α β γ δ ε
.LE
.P
Note that any use of \fCAFM\fR, OpenType, or TrueType files requires that the
output of \*(TR is passed to the exactly matching version of \fIdpost,\fR i.e.
to the one that was delivered with the same release of this package.
Sending such \*(TR output directly to a print spooler that invokes a
system version of \fIdpost\fR will thus usually not work.
.P
The historical method requires font tables to be generated manually.
It is still supported, and is still the default for the lower-resolution
``post'' \*(PS device, but it is not recommended anymore that it is
used for adding fonts. Localized input processing according to \fCLC_CTYPE\fR
is not available with this method.
.S "Installing \*(PS Type\ 1 fonts"
.P
Making additional fonts available is easy with the current method. If you
buy a \*(PS Type\ 1 font for use with \*[TR,] select the Windows
version. You will get a set of files from the vendor. Only two of them
are of interest for \*[TR:]
.sp
.in +3m
.ti -1m
xxxxxxxx.afm
.br
This is the metrics file. \*(TR accesses it to learn the widths
of characters in the font.
.sp
.ti -1m
xxxxxxxx.pfb
.br
This file contains the actual glyph data. \*(TR does not really
need this file, but the printer or \fCPDF\fR converter does. In many
cases, it is most convenient to include the data directly into
the .ps file generated, as in the examples above.
.in -3m
.sp
.P
Create a directory to hold your fonts. For compatibility with future
versions of \*[TR,] it is recommended that it is put outside the \*(TR
hierarchy /\&usr/\&ucblib/\&doctools; something below /\&usr/\&local may be a
good choice. For each font you want to install, copy or link both the
\fCAFM\fR and the \fCPFB\fR file into the directory.
Set the \fCTROFFONTS\fR environment
variable to this directory; if you have multiple font directories, you
can separate them in \fCTROFFONTS\fR by colons, just as in the \fCPATH\fR variable
for the shell, e.g.
``\fCTROFFONTS\fR=\:/\&usr/\:\&local/\:\&share/\:\&fonts\&:\:/\&usr/\:\&share/\:\&fonts
export \fCTROFFONTS\fR''.
Write the definition in your ``.profile'' or a similar startup file
to make it permanent.
You can now use the fonts with \*[TR.] If you want to install
more fonts later, it is sufficient to put them into the font directory.
.S "Installing OpenType or TrueType fonts"
.P
The procedure for OpenType and TrueType fonts is nearly the same as for
Type\ 1 fonts, except that there is only one file ``FontName.otf'' (or
``FontName.ttf'') with them that contains both metrics and glyph data.
Just copy this file to a directory given in the \fCTROFFONTS\fR path.
.S "Using OpenType features"
.P
High-quality OpenType fonts may contain feature tables that allow special
typographic effects. For example, the \*(FT font
.ie r GaramondPremrPro \{\
contains titling capitals that can be mapped to the input range of regular
capitals
.\}
.el contains superscripts characters that can be accessed
with the ``.feature'' request in \*[TR:]
.EX
&do xflag 3
&fp 1 \fCR\fN AGaramondPro-Regular otf
&fp 0 \fCT\fN AGaramondPro-Regular otf
&feature \fCT\fN +titl
\fCREGULAR CAPITALS\fN
&sp
.fzoom T .92
&ft \fCT\fN
\fTTITLING CAPITALS\fN
.fzoom T 1
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&fp 0 U LinLibertine_R otf
&feature U +sups
&ft R
Regular text which ends with\efUsuperscript\efR.
.LP Regular text which ends with\fUsuperscript\fR.
.LE
.P
To retrieve a list of features in an individual font that are available
with \*[TR,] use ``otf_info \[minus]s font.otf''. Typical useful features are:
.sp
.TS
center;
lfN l.
+c2sc	converts capitals to small capitals
+case	T{
substitutions for use in combination with text
in all-capital letters
T}
+onum	old-style numerals
+pnum	proportional (lining) numerals
+pnum +onum	proportional old-style numerals
+smcp	converts lower-case letters to small capitals
+smcp +c2sc	converts all letters to small capitals
+titl	titling characters
+sups	superscript
+infs	subscript
+zero	slashed zero
.TE
.sp
.P
Features such as ``aalt'' or ``ornm'' which only map sets of very special
characters to different positions are normally not useful with \*(TR since
these characters can be accessed directly
using ``\[backslash][name]'' escape sequences
anyway. To make an individual alternate character the default, the ``.f\;tr''
request can be used:
.EX
&do xflag 3
&fp 2 \fCI\fN AGaramondPro-Italic otf
&ftr \fCI\fN Q\[backslash][Q.swash]
&ft \fCI\fN
\fIUsing a swash capital in the word ``Quality.''\fN
.EE
.LX
&do xflag 3
&fp 0 R LinLibertine_R otf
&ftr R h\e[h.alt]
&ft R
Using alternate character in the word ``hello.''
.LP Using alternate character in the word ``\[h.alt]ello.''
.LE
.P
Feature mappings result in changes to the same internal data structures as
the ``.f\;tr'' request. It is thus possible to make adjustments to mappings by
using ``.f\;tr'' after ``.feature'', or to create personalized variants by using
``.f\;tr'' based on the data obtained from ``otf_info \[minus]s''.
.P
The ``.feature'' request must still be active for a font
when a character is printed;
disabling a feature with ``.feature \fCF\fR \[minus]feat'' only works completely
if all of its mappings are still in position. It is thus recommended that
the ``.feature'' request is used only once for a font immediately after it
has been mounted, and that a font is mounted multiple times, each time for
enabling an individual feature set. Doing so has the additional advantage
that switching between features is conveniently possible using the ``\[backslash]f''
escape sequence.
.S "Using fonts with old-style numerals"
.P
A Type\ 1 font with old-style numerals but otherwise standard characters
usually does not require any special mechanism. It can simply be mounted,
selected, and used.
.P
Old-style numerals contained in OpenType fonts can be accessed conveniently
by mapping them to the standard \fCASCII\fR numbers with the ``.feature'' request:
.EX
&do xflag 3
&fp 1 \fCR\fN AGaramondPro-Regular otf
&feature \fCR\fN +onum
The numerals \fR0 1 2 3 4 5 6 7 8 9\fN are in old-style.
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&feature R +onum
The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
.LP The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
.LE
.S "Using fonts with small capital letters"
.P
Small capital fonts sometimes need letter space tracking. Thus e.g.
to use the \*(FT small capital font, you can write something like
.EX
&do xflag 3
&fp 0 \fCSC\fN gdsc____ pfb
&track \fCSC\fN 1 .2 24 2
&ft \fCSC\fN
\f(SCThis text prints in Small Capitals.\fP
.EE
.if r GaramondPremrPro \{\
.P
With an OpenType font, the ``.feature'' request is useful again:
.\}
.EX
&do xflag 3
&fp 0 \fCSC\fN AGaramondPro-Regular otf
&feature \fCSC\fN +smcp
&track \fCSC\fN 1 .3 24 3
&ft \fCSC\fN
\f(SCThis text prints in Small Capitals.\fN
.EE
.LX
&do xflag 3
&fp 0 SC LinLibertine_R otf
&feature SC +smcp
&track SC 1 1.2 40 0
&ft SC
This text prints in Small Capitals.
.LP \f(SCThis text prints in Small Capitals.\fR
.LE
.S "Using a combination of expert and standard fonts for small capitals"
.P
A Type\ 1 expert font contains small capital letters but no upper-case
capital letters. Since it would be very inconvenient to change the font
explicitly for each upper-case letter, the fallback sequence is useful
in this case. The expert font is selected as text font, but for each
upper-case letter encountered, \*(TR changes automatically to the
standard font:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCE\fN gerg____ pfb
&track \fCE\fN 1 .2 24 2
&fallback \fCE R\fN
&ft \fCE\fN
\f(SCThis text prints in Small Capitals.\fN
.EE
.LX
&do xflag 3
&fp 1 R normalfont pfb
&fp 0 E expertfont pfb
&track E 1 .2 24 2
&fallback E R
&ft E
This text prints in Small Capitals.
.LP \f(SCThis text prints in Small Capitals.\fR
.LE
.P
For OpenType fonts, all small capital letters are contained within the
base font, and the ``smcp'' feature accesses them as shown above.
.S "Using a combination of expert and standard fonts for old-style numerals"
.P
This also uses the fallback sequence, but since the standard numerals
are present in the standard font, they have to be hidden first so that
\*(TR does not select them:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCE\fN gerg____ pfb
&fallback \fCR E\fN
&hidechar \fCR\fN 0123456789
The numerals \fR0 1 2 3 4 5 6 7 8 9\fN are in old-style.
.EE
.LX
&do xflag 3
&fp 1 R normalfont pfb
&fp 0 E expertfont pfb
&fallback R E
&hidechar R 0123456789
&ft R
The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
.LP The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
.LE
.S "Using the expert font for both small capitals and old-style numerals"
.P
The examples above can also be combined.
Since the ``.track'' request does not
affect the tracking of fonts that are selected by the fallback sequence,
it is sufficient to mount each font once:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCE\fN gerg____ pfb
&fallback \fCR E\fN
&fallback \fCE R\fN
&track \fCE\fN 1 .2 24 2
&hidechar \fCR\fN 0123456789
The numerals \fR0 1 2 3 4 5 6 7 8 9\fN are in old-style.
&br
&ft \fCE\fN
\f(SCBut this text prints in Small Capitals.\fN
.EE
.LX
&do xflag 3
&fp 1 R normalfont pfb
&fp 0 E expertfont pfb
&fallback R E
&fallback E R
&track E 1 .2 24 2
&hidechar R 0123456789
&ft R
The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
.LP The numerals 0 1 2 3 4 5 6 7 8 9 are in old-style.
&br
&ft E
But this text prints in Small Capitals.
.LP \f(SCBut this text prints in Small Capitals.\fR
.LE
.S "Using the expert font for ligatures"
.P
\*(PS Type\ 1 fonts usually do not contain ligatures for ff, ffi, and
ffl in the base font; an expert font delivers them in addition. Automatic
substitution of such ligatures can be enabled using the
.lg 0
``.flig''
.lg
request in combination with the fallback sequence:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCE\fN gerg____ pfb
&fallback \fCR E\fN
&flig \fCR\fN ff \e(ff ffi \e(Fi ffl \e(Fl
e\(ffective o\(Fice o\(Fline
.EE
.LX
&do xflag 3
&fp 1 R normalfont pfb
&fp 0 E expertfont pfb
&fallback R E
&flig R ff \e(ff ffi \e(Fi ffl \e(Fl
&ft R
effective office offline
.LP e\(ffective o\(Fice o\(Fline
.LE
.P
OpenType fonts contain all available ligatures in the base font,
so no special procedure needs to be applied with them.
.S "Defining additional ligatures"
.P
Fonts may provide ligatures beyond the five standard \*(TR ones.
They are not activated by default
regardless of any definitions in the font metrics files,
but can be enabled individually as desired;
\*(TR will then replace sequences of characters automatically
with them as with the standard ligatures.
For example, \*(FT
contains ligatures for use with the historic ``\[longs]'' letter variant:
.EX
&do xflag 3
&fp 1 \fCR\fN GaramondPremrPro otf
&flig R ſſ \e[longs_longs] ſi \e[longs_i] ſſi \e[longs_longs_i]
Uſe theſe ligatures for cla\[longs_longs_i]c typography.
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&flig R \e[longs]\e[longs] \e[longs_longs] \e[longs]i \e[longs_i]
&flig R \e[longs]\e[longs]i \e[longs_longs_i]
U\e[longs]e the\e[longs]e ligatures
for cla\e[longs]\e[longs]ic typography.
.LP U\[longs]e the\[longs]e ligatures for cla\[longs_longs_i]c typography.
.LE
.P
\*(TR splits ligatures in two parts
when hyphenating words.
It is thus necessary that any part of a ligature
that is not a single character is also defined as a ligature,
so ``\[longs_longs]'' and ``\[longs_i]''
are prerequisites for ``\[longs_longs_i]''.
.P
It is normally not advisable
to enable ligatures with \[s_p]ecial display forms
.if !r GaramondPremrPro (such as in ``se\[c_t]ion'')
using the ``.f\;lig'' mechanism;
they should be set manually as special characters
.ie r GaramondPremrPro (``\e[s_p]'' in this case)
.el (``\e[c_t]'' in this case)
at precise locations.
.S "Choosing between multiple possible ligatures"
.P
If a font contains only two-character ligatures,
there are two possibilities for automatic ligature building
with an input sequence that would form a three-character ligature,
e.g., ``f\^f\^i'' could be constructed
as ``\(ff\|i'' or ``f\|\(fi''.
\*(TR normally selects the first ligature available,
so ``\(ff\|i'' would be the default.
In many cases, the other choice
would be aesthetically preferable;
this is the application for the ``.fdeferlig'' request:
.EX
&do xflag 3
&fp 1 \fCR\fN GaramondPremrPro otf
&flig R ſſ \e[longs_longs] ſi \e[longs_i]
&fdeferlig R ſſi
Choo\[longs_i]ng the ſecond ligature looks poſ\[longs_i]bly better.
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&flig R \e[longs]\e[longs] \e[longs_longs] \e[longs]i \e[longs_i]
&fdeferlig R \e[longs]\e[longs]i
Choo\e[longs]ing the \e[longs]econd ligature looks po\e[longs]\e[longs]ibly better.
.LP Choo\[longs_i]ng the \[longs]econd ligature looks po\[longs]\[longs_i]bly better.
.LE
.S "Combining different fonts"
.P
Different fonts often have different visual sizes even if they are set
in the same nominal point size.
Also fonts from different vendors are often based on
different standards for character heights.
To adjust this, the ``.fzoom'' request is available.
As implied by this purpose,
it only applies to characters that are actually in the
current font, not to characters from another font that have been
selected using the fallback sequence.
.EX
&do xflag 3
&fp 1 \fCR\fN AGaramondPro-Regular otf
&fp 0 \fCGI\fN GillSansStd otf
&fzoom \fCGI\fN .94
.if r GillSansStd \
\[backslash]f(GI\f(GIGill Sans\fN\[backslash]fR must be adjusted to fit with Adobe Garamond.
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&fp 0 M LinLibertine_M otf
&track M 1 -.1 40 -0
&fzoom M .8
\efMLibertine Monospace\efR must be adjusted to fit with Roman.
.LP \fNLibertine Monospace\fR must be adjusted to fit with Roman.
.LE
.P
The ``.fzoom'' request affects all characters set in the respective font on
the current output line. To create single zoomed words, mount a font twice
under different names, but zoom it only once.
.S "Spacing out individual words"
.P
Spacing out the characters of individual words is commonly done
for highlighting text e.g. with German
blackletter faces;
the ``.track'' request can be used for this as well.
Like ``.fzoom'', ``.track'' applies
to all characters in the respective font on an entire output line. Thus it
is also necessary to mount a font twice but to track it only once when it
is used for tracking individual words.
.S "Setting text in all-capital letters"
.P
When setting text in all-capital letters, it is normally necessary
to zoom the font to a smaller size than that of the lower-case text
surrounding it, and to track it as well. Mounting the regular font
a second time is the most convenient way to handle this:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCXC\fN gdrg____ pfb
&track \fCXC\fN 1 .2 24 2
&fzoom \fCXC\fN .9
Regular text and \[backslash]f(XC\fCALL-CAPITAL TEXT\fN\[backslash]fP which ends.
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&fp 0 C LinLibertine_R otf
&track C 1 1.2 40 0
fzoom C .9
Regular text and \efCALL-CAPITAL TEXT\efR which ends.
.LP Regular text and \fCALL-CAPITAL TEXT\fR which ends.
.LE
.S "Pairwise kerning"
.P
Pairwise kerning is enabled unless the
\fN\[minus]x0\fR option is given. The ``.kern''
request disables it. Kerning tables are initially read from the \fCAFM\fR,
OpenType, or TrueType files; this default kerning only applies if two
adjacent characters are from the same font.
A font-specific kerning table
can be disabled using the ``.fkern'' request.
.P
There are two methods to
adjust the kerning tables: In some cases, it is most convenient to
create a private copy
of the \fCAFM\fR file and to adjust the ``\fCKPX\fR'' entries
in it. This has the advantage that the modified kerning pairs are
immediately available for use in other documents.
.P
For OpenType or TrueType fonts, or for cases where this is not suitable
with Type\ 1 fonts, or not possible because the characters in the kerning
pair originate from different fonts, \*(TR provides the ``.kernpair''
request:
.EX
&do xflag 3
&fp 1 \fCR\fN gdrg____ pfb
&fp 0 \fCE\fN gerg____ pfb
&fallback \fCR E\fN
&hidechar \fCR\fN 0123456789
&kernpair \fCE\fN 0 \fCR\fN / 50
&kernpair \fCR\fN / \fCE\fN 1 \[minus]90
&kernpair \fCE\fN 1 \fCR\fN / 40
&kernpair \fCR\fN / \fCE\fN 2 \[minus]80
\fR0/1/2\fP
.EE
.LX
&do xflag 3
&fp 1 R LinLibertine_R otf
&feature R +onum
&kernpair R 0 R / 50
&kernpair R / R 1 \[minus]90
&kernpair R 1 R / 40
&kernpair R / R 2 \[minus]80
0/1/2
.LP 0/1/2
.LE
.P
In this example, old-style numerals from \*(FT are mixed
with the slash character, and are adjusted to
achieve matching visual letter spacing.
.S "Kerning of a character in any combination"
.P
It is sometimes useful to add a certain amount of space whenever a
character appears, for example before ``;'' or ``?'', or on the inner
sides of guillemots in French/Swiss style. The ``.kernaf\;ter'' and
``.kernbefore'' requests are useful for this:
.EX
&do xflag 3
&kernafter \fCR\fN ; 66 ? 66
.EE
.LX
&do xflag 3
&kernafter R ; 66 ? 66
.LE
.P
If the characters affected by these requests are also member of a
regular kerning pair, the resulting added space is the sum of both
definitions. These requests are applied at the same places as kerning
pairs, i.e. they have no effect if following or preceding a motion
command, ``\[backslash]\[ampersand]'' or line margin,
and they are additionally restricted to
have no effect if the other character is a space.
.S "Hanging characters"
.P
Since there are no tables for hanging characters in \fCAFM\fR files, values
must be given explicitly in \*(TR source code using the ``.lhang'' and
``.rhang'' requests. Both accept a font specification followed by one
or more pairs of characters and values:
.EX
&do xflag 3
&ps 10
&fp 1 \fCR\fN gdrg____ pfb
&lhang \fCR\fN V \[minus]50 J \[minus]40
&rhang \fCR\fN \[backslash](hy 80
.EE
.LX
&do xflag 3
&ps 10
&fp 1 R somefont pfb
&lhang R V \[minus]50 J \[minus]40
&rhang R \[backslash](hy 80
.LE
.P
Adjustments are given in units of 1/72\|000 inch multiplied by the actual
point size, or 1/1\|000 of the em size when the line is printed. Thus in
this example, the left margin is shifted to the left by .5 points when
the leftmost letter is a ``V'', and by .4 points when the leftmost letter
is a ``J''; the right margin is shifted to the right by .8 points when
the rightmost letter is a hyphen.
.P
Left margin adjustments are evaluated before the letters that fit on the
current line are computed, and can thus principally be of any length. In
contrast, right margin adjustments are evaluated after this computation
is finished, and the adjustment is simply added to the word space of the
output line. Thus a positive right adjustment that is large in relation
to the line length will cause visible holes, and a negative adjustment
will ultimately cause the words on the line to be printed over each
other. This is not a problem for the typical application of hanging
punctuation for visual alignment, though; if a line with eight word
spaces is shifted in the example above, each word space is enlarged
by only 1/100 em.
.S "Mathematical and other special characters"
.P
Special mathematical characters like
``\[backslash](\[plus]\[minus]'', greek letters like ``\[backslash](*a'',
and, with the ``pslow'' device,
even the punctuation characters
\[backslash](or \[backslash]\[minus] \[backslash]\`
\[backslash]\' \[quotedbl] # < > @ \[backslash] \[asciicircum] \[asciitilde] are
normally not chosen from the current font, but
are taken from the special font instead.
(\*(PS names
(e.g. ``\[backslash][numbersign]'', ``\[backslash][less]'',
``\[backslash][at]'')
access characters from the current font.)
The ``.fps'' request can be used to override this behavior. In particular,
this is useful to set mathematical text with a different font. To use
\*(FT for greek letters and mathematical symbols:
.EX
&do xflag 3
&fps math,greek,punct 1 \fCR\fN GaramondPremrPro otf
&fp 2 \fCI\fN GaramondPremrPro-It otf
&fallback \fCI R\fN
&\fCEQ\fN
a \[asciicircum]=\[asciicircum] pi {r sup 2}
&\fCEN\fN
.EE
.LX
&do xflag 3
&fps math,greek,punct,large 1 R LinLibertine_R otf
&fp 2 I LinLibertine_RI otf
&fallback I R
&EQ
a \[asciicircum]=\[asciicircum] pi {r sup 2}
&EN
.LE
.S "Helper utilities"
.P
The \fIotf_info\fR utility shows the contents of an OpenType or TrueType
font file just as \*(TR interprets it. It emits an \fCASCII\fR format that
is readable by humans and can also be used for further processing with
shell scripts. It is useful to retrieve lists of characters and features
supported with the font.
.P
The shell script ``stuff\&/\&showfont.sh'' in the source code distribution
uses \*(TR and possibly \fIotf_info\fR to print a map of all characters in an
\fCAFM\fR, OpenType, or TrueType font along with their \*(PS names.
.S "Limitations"
.P
\fIdpost\fR uses a method to embed \fCCFF\fR-based (\*(PS-style) OpenType
fonts in \*(PS documents that is only available with \*(PS\ 3
interpreters; older printing equipment that uses \*(PS Level\ 2 or below cannot
handle such documents directly.
The recommended workaround is to convert the \*(PS output
to a \fCPDF\fR document
and to print it using a \fCPDF\fR viewer
or reverse conversion program.
Also you may have
to update your copy of Ghostscript in order to create \fCPDF\fR files with
proper font embedding from such output.
.P
Embedding TrueType fonts in \*(PS documents requires \*(PS\ 3
or \*(PS Level\ 2 of at least version 2013.
.P
\*(TR only supports OpenType features that result in single-character
substitutions insensitive of context (except for the ``fi fl ff ffi ffl''
ligatures and kerning which are enabled by default if possible). Also \*(TR
ignores any features that are not mapped
to the ``\fCDFLT\fR'' or ``latn'' languages
in an OpenType font.
.ig
.P
The default \*(PS/Unicode conversion tables currently only contain
European character names; other characters are simply ignored when they
occur in input text. The ``Adobe Glyph List'' cannot be used for this task
since it lists many characters in positions which are not appropriate for
the \*(TR input mechanism. For example, small capitals are put in the
private area there which would make it necessary to transform ASCII input
text in order to use them; the \*(TR mechanism in contrast allows them to
be selected simply with a font change. Contributions of appropriate tables
for other languages are welcome.
