Characters words and fonts/Define the set of font sizes and the line spacing

From Wiki
Jump to navigation Jump to search

The full set of relative font sizes available by default

As defined in font-ini, all sizes in pt, except factor.

size factor 4pt 5pt 6pt 7pt 8pt 9pt 10pt 11pt 12pt 14.4pt 17.3pt 20.7pt
xx 0.6 4 5 5 5 5 5 6 7 8 10 12 14.4
x 0.8 4 5 5 6 6 7 8 9 10 12 14.4 17.3
tf 1.0 4 5 6 7 8 9 10 11 12 14.4 17.3 20.7
a 1.2 4.8 6.0 7.2 8.4 9.6 10.8 12.0 13.2 14.4 17.3 20.7 24.8
b 1.44 5.8 7.2 8.6 10.1 11.5 13.0 14.4 15.8 17.3 20.7 24.9 29.8
c 1.728 6.9 8.6 10.4 12.1 13.8 15.6 17.3 19.0 20.7 24.9 29.9 35.8
d 2.074 8.3 10.4 12.4 14.5 16.6 18.7 20.7 22.8 24.9 29.9 35.9 42.9
_
scriptscript 0.5 4 5 5 5 5 5 5 6 7 9 10 12
script 0.7 4 5 5 6 6 7 7 8 9 11 12 14.4
small 0.8 4 4 5 5 6 7 8 9 10 12 14.4 17.3
big 1.2 6 7 8 9 10 11 12 12 14.4 17.3 20.7 20.7

Customization of relative font sizes set with \definebodyfontenvironment

The mapping of particular command suffixes (a, x, etc.) and current bodyfont size to effective font size can be changed by \definebodyfontenvironment. The default values defined in font-ini are:

\definebodyfontenvironment
  [\s!default]
  [        \s!text=1.0,
         \s!script=0.7,
   \s!scriptscript=0.5,
              \c!a=1.200,
              \c!b=1.440,
              \c!c=1.728,
              \c!d=2.074,
                 *=\currentfontscale, % wildcard
              \c!x=0.8,
             \c!xx=0.6,
            \c!big=1.2,
          \c!small=0.8,
 \c!interlinespace=,
             \c!em=\v!slanted]

N.B.: script and scriptscript are used in math mode.

It is also possible to set the scaling factors for specific font sizes. For example, if you want \tfa to set the effective font size to 12pt when the bodyfont size is 10pt, and to set the effective font size to 14pt when the bodyfont size is 11pt, then add

\definebodyfontenvironment [10pt] [a=12pt]
\definebodyfontenvironment [11pt] [a=14pt]

Note: When the first parameter is default, the scaling factors must have numerical values. When the first parameter is a font size (e.g., 12pt), the scaling factors can either be numerical value or a dimension.

\definebodyfontenvironment is described in detail in the ConTeXt manual and the font-ini source file.

Reminder: Font size can be combined with font styles alternatives. As a shortcut, you can use \bfa to get bold font scaled by 1.2, \bfx to get a bold font scaled by 0.8 and similar commands for other font styles.

Adding a new font size to the set with \definefontsize

  • \definefontsize[e]
    
    \definebodyfontenvironment
      [default]
      [b=4,e=10]
    
    This will be {\tfb really} {\bfe Huge}
    

    yields


Use the style options to set the appropriate font size and line spacing

The font switches are meant for changing the font style, alternative, or size of a few words: they do not change the bodyfont, so they don't affect interline spacing or math font sizes.

These caveats also hold when the font switches are used as style directives for style=... in any setup command that accepts style option.

  • Reminder: mnemonic font switches can also be used for all style=... options, and while using them as style options, you can just give the command name without the backslash.

For example, if you are defining a block quote environment that uses a smaller font size, instead of

\definedelimitedtext[extract][style=\tfx]

you should use

\definedelimitedtext[extract][style={\tfx\setupinterlinespace}]
  • \definedelimitedtext[extractA][style=\tfxx]
    \definedelimitedtext[extractB][style={\tfxx\setupinterlinespace}]
    
    \startextractA
    \input ward
    \stopextractA
    
    \startextractB
    \input ward
    \stopextractB
    

Note however that \setupinterlinespace is added automatically for section heads, so the following works correctly:

\setuphead[section][style=\bfa]