Pseudo Small Caps

From Wiki
Revision as of 16:28, 8 June 2020 by Garulfo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

< Text formatting

Your font has no Small Caps variant? Do you need Small Caps switching depending on the \it, \bf, \bi, \tt, \ss, ... ? Here is the recipe for generating and installing Pseudo Small Caps (small letters are scaled down versions of capitals - typographicaly not clear solution but if the font has no real Small Caps...). The example is done on Latin Modern family but can be applied to another Type1 font.

1. Pseudo Small Caps generation. All commands (txt)

texfont --fontroot=X:\ --en=ec --ve=public --co=lm --source=auto --ca=0.8 lmbx10


2. Typescript definitions. Complete type script (copy URL to browser?!)

a) Metric file correspondencies:
\starttypescript [all] [latin-modern,computer-modern] [texnansi,ec,qx,pl0,il2,t5]
...
  \definefontsynonym [cmtcsc10]  [\typescriptthree-lmtcsc10]  [encoding=\typescriptthree]
...
  \definefontsynonym [cmcscbx10] [\typescriptthree-lmbx10-capitalized-800] [encoding=\typescriptthree]
\stoptypescript


b) Making \Var[SmallCaps] in Serif, Sans, and Mono:
\starttypescript [serif] [computer-modern,latin-modern] [default]
  ...
  \definefontsynonym [SerifRegular]                      [ComputerModern]
  \definefontsynonym [SerifBold]                         [ComputerModern-Bold]
  \definefontsynonym [SerifItalic]                       [ComputerModern-Italic]
  \definefontsynonym [SerifBoldItalic]                   [ComputerModern-BoldItalic]
  \definefontsynonym [SerifRegularCaps]	                 [ComputerModern-Caps]

  \definefontsynonym [SerifSmallCaps]	                 [ComputerModern-Caps]
  \definefontsynonym [SerifItalicSmallCaps]              [cmcsci10]
  \definefontsynonym [SerifBoldSmallCaps]                [cmcscbx10]
  \definefontsynonym [SerifBoldItalicSmallCaps]          [cmcscbxi10]

  \definefontsynonym [SerifRegular]                      [Serif]
  \definefontsynonym [SerifRegularSmallCaps]             [SerifSmallCaps]

  \definefontvariant [Serif] [SmallCaps] [SmallCaps]
\stoptypescript

\starttypescript [sans] [computer-modern,latin-modern] [default]
  ...
\stoptypescript

\starttypescript [mono] [computer-modern,latin-modern] [default]
  ...
\stoptypescript


3. Usage. PDF Source (copy URL to browser?!)

\usetypescriptfile[type-lm-var]
\usetypescript[all][computer-modern,latin-modern][ec]
\usetypescript[serif][computer-modern,latin-modern][default]
\usetypescript[sans][computer-modern,latin-modern][default]
\usetypescript[mono][computer-modern,latin-modern][default]
\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]

\def\sc{\Var[SmallCaps]}

\starttext
{    Ahoj \sc Ahoj}\par
{\it Ahoj \sc Ahoj}\par
{\bf Ahoj \sc Ahoj}\par
{\bi Ahoj \sc Ahoj}\par

{\ss
{    Ahoj \sc Ahoj}\par
{\it Ahoj \sc Ahoj}\par
{\bf Ahoj \sc Ahoj}\par
}

{\tt % Note: pseudo caps breaks monospacing!
{    Ahoj \sc Ahoj}\par
{\it Ahoj \sc Ahoj}\par
}
\stoptext