Font Variants

From Wiki
Jump to navigation Jump to search

This page is presented as an extension of Bill's tutorial on enabling new fonts:

Bill creates a type-sabon typescript file. Our example starts from the same place:

% Adobe Sabon
\starttypescript [serif] [sabon] [texnansi]
 \definefontsynonym [Sabon-Roman]          [texnansi-sar]  [encoding=texnansi]
 \definefontsynonym [Sabon-Bold]           [texnansi-sab]  [encoding=texnansi]
 \definefontsynonym [Sabon-Italic]         [texnansi-sai]  [encoding=texnansi]
 \definefontsynonym [Sabon-Bold-Italic]    [texnansi-sabi] [encoding=texnansi]
 \definefontsynonym [Sabon-Roman-SmallCaps][texnansi-sarsc]  [encoding=texnansi]
 \definefontsynonym [Sabon-Italic-OSF]     [texnansi-saiof]  [encoding=texnansi]
 \definefontsynonym [Sabon-Bold-OSF]       [texnansi-sabof]  [encoding=texnansi]
 \definefontsynonym [Sabon-Bold-Italic-OSF][texnansi-sabio]  [encoding=texnansi]

The sabon encoding typescript remains the same from Bill's example. The name typescript gains a few more entries, however:

\starttypescript [serif] [sabon] [name]
 \definefontsynonym [Serif]           [Sabon-Roman]
 \definefontsynonym [SerifBold]       [Sabon-Bold]
 \definefontsynonym [SerifItalic]     [Sabon-Italic]
 \definefontsynonym [SerifBoldItalic] [Sabon-Bold-Italic]
 \definefontsynonym [SerifCaps]       [Sabon-Roman-SmallCaps]

The above remain the same, but then there follow some more definitions:

  \definefontsynonym [SerifRegular]       [Serif]

SerifRegular must be defined as a synonym to Serif, because of the way we navigate the font variants internally. The following synonyms have "OsF" appended to the existing font synonyms on the left side, and point to the defined oldstyle figure variations on the right hand side:

 \definefontsynonym [SerifRegularOsF]    [Sabon-Roman-SmallCaps]
 \definefontsynonym [SerifBoldOsF]       [Sabon-Bold-OSF]
 \definefontsynonym [SerifItalicOsF]     [Sabon-Italic-OSF]
 \definefontsynonym [SerifSlantedOsF]    [Sabon-Italic-OSF]
 \definefontsynonym [SerifBoldItalicOsF] [Sabon-Bold-Italic-OSF]
 \definefontsynonym [SerifBoldSlantedOsF][Sabon-Bold-Italic-OSF]
 \definefontsynonym [SerifCapsOsF]       [Sabon-Roman-SmallCaps]

Finally, we define a variant. It says, in shorthand: for this Serif font, a \Var[osf] command will postpend OsF to the current font name, and switch:

 \definefontvariant  [Serif][osf][OsF]
\starttypescript [Sabon] 
 \definetypeface [Sabon] [rm] [serif] [sabon] [default] [encoding=texnansi]

Usage would proceed this way:


This is Sabon roman 0123456789, 
old-style \Var[osf] 0123456789, 
{\it\Var[osf] italic 0123456789,} 
{\bf bold 01234\Var[osf]56789,} 
and {\bi bold-italic \Var[osf]0123456789.}

{\em \bf This is also \Var[osf] bold-italic 0123456789.}