Jump to navigation Jump to search
195 bytes removed ,  23:39, 22 September 2013
no edit summary
In ConTeXt there are four ways to switch fonts:
* font style (<{{cmd>|rm</cmd>}}, <{{cmd>|ss</cmd>}}, etc.),* font size (<{{cmd>|tfa</cmd>}}, <{{cmd>|tfb</cmd>}}, etc.),* alternative font style (<{{cmd>|bold</cmd>}}, <{{cmd>|sans</cmd>}}, etc.),* a complete font change (<{{cmd>|setupbodyfont</cmd>}}, <{{cmd>|switchtobodyfont</cmd>}}).
== Font styles ==
There are three types of font families: serif, sans serif, and teletype. To
switch between these families, use <{{cmd>|rm</cmd> }} for serif, <{{cmd>|ss</cmd> }} forsans serif, and <{{cmd>|tt</cmd> }} for teletype.
Each of these families come in different styles: upright, bold, italic,
slanted, bold-italic, bold-slanted, and small-capped. To switch to a different
style, use <{{cmd>|tf</cmd> }} for upright, <{{cmd>|bf</cmd> }} for bold, <{{cmd>|it</cmd>}}for italic, <{{cmd>|sl</cmd> }} for slanted, <{{cmd>|bi</cmd> }} for bold-italic,<{{cmd>|bs</cmd> }} for bold-slanted, and <{{cmd>|sc</cmd> }} for small-capped.
You can generally combine font families and font styles, so if you want to
There is a font switch <{{cmd>|em</cmd> }} to ''emphasize'' text. This is somewhat
special: it does automatic italic correction and changes the style depending
on the current font style. For example, if the current font style is upright,
<{{cmd>|em</cmd> }} switches to slanted; and if the current font style is slanted,<{{cmd>|em</cmd> }} switches to upright.
ConTeXt uses the Latin Modern fonts by default; these fonts look
Occasionally one needs to change the font size. ConTeXt provides two series
of commands for that. To increase the font you can use <{{cmd>|tfa</cmd> }} to scalethe font size by a factor of <code>1.2</code>, <{{cmd>|tfb</cmd> }} to scale by a factor of<code>(1.2)^2 = 1.44</code>, <{{cmd>|tfc</cmd> }} to scale by <code>(1.2)^3 = 1.728</code> and <{{cmd>|tfd</cmd> }} to
scale by <code>(1.2)^4 = 2.074</code>.
To decrease the font size, you can use <{{cmd>|tfx</cmd>}}to scale the font by a factor of <code>0.8</code> and <{{cmd>|tfxx</cmd> }} to scale by a factor
of <code>0.6</code>. The scale factors can be a function of the current font size and can
be changed by <{{cmd>|definebodyfontenvironment</cmd>}}.
For example, if you want
<{{cmd>|tfa</cmd> }} to be equal to 12pt when you are using 10pt font, and be equal to
14pt when you are using 11pt font, then add
\definebodyfontenvironment [11pt] [a=14pt]
<{{cmd>|definebodyfontenvironment</cmd> }} is described in detail in
the ConTeXt manual and the [[source:font-ini.tex|font-ini.tex]] source file.
Font size can be combined with font styles. As a shortcut, you can use
<{{cmd>|bfa</cmd> }} to get bold font scaled by <code>1.2</code>, <{{cmd>|bfx</cmd> }} to get a bold font
scaled by <code>0.8</code> and similar commands for other font styles.
words: they do not change the interline spacing and math font sizes. So, if
you want to change the font size of an entire paragraph, use
<{{cmd>|switchtobodyfont</cmd> }} described below in [[Font_Switching#Complete_font_change|Complete Font Change]]. However, it
is fine to use them as style directives in setup commands, that is, using them
as an option for <code>[[Style_and_Color_Parameters|style=]]...</code> in any setup command that accepts
While learning a document markup language like ConTeXt, it can be hard to
remember all the commands. ConTeXt provides easy to remember alternative
font styles. So for bold you can use <{{cmd>|bold</cmd>}}, for italic you can use<{{cmd>|italic</cmd>}}, for slanted you can use <{{cmd>|slanted</cmd>}}, and so on. You can
probably guess what the following do:
| <{{cmd>|normal</cmd> }} | <{{cmd>|slanted</cmd>}}
| <{{cmd>|boldslanted</cmd>}} | <{{cmd>|slantedbold</cmd>}}
| <{{cmd>|bolditalic</cmd>}} | <{{cmd>|italicbold</cmd>}}
| <{{cmd>|small</cmd>}} | <{{cmd>|smallnormal</cmd>}}
| <{{cmd>|smallbold</cmd>}} | <{{cmd>|smallslanted</cmd>}}
| <{{cmd>|smallboldslanted</cmd>}} | <{{cmd>|smallslantedbold</cmd>}}
| <{{cmd>|smallbolditalic</cmd>}} | <{{cmd>|smallitalicbold</cmd>}}
| <{{cmd>|sans</cmd>}} | <{{cmd>|sansserif</cmd>}}
| <{{cmd>|sansbold</cmd>}} | <{{cmd>|smallcaps</cmd> }}
In addition, the commands <{{cmd>|smallbodyfont</cmd> }} and<{{cmd>|bigbodyfont</cmd> }} can be used to change the font size.
These alternative font styles are pretty smart. You can either use them as
If you need to change to a different font size and take care of interline
spacing, you can use <{{cmd>|switchtobodyfont</cmd>}}. For example, to switch to 12pt
you can use <code>\switchtobodyfont[12pt]</code>.
smaller font size use <code>\switchtobodyfont[small]</code>. The exact
size used for big and small can be set using
The <{{cmd>|setupbodyfont</cmd> }} command accepts all the same arguments as<{{cmd>|switchtobodyfont</cmd>}}. The difference between the two is that<{{cmd>|setupbodyfont</cmd> }} also changes the font for headers, footers and otherpage markings, while <{{cmd>|switchtobodyfont</cmd> }} does not. So you should use<{{cmd>|setupbodyfont</cmd> }} for global font definitions to apply to the whole document, and<{{cmd>|switchtobodyfont</cmd> }} for local font changes. The effect of<{{cmd>|switchtobodyfont</cmd> }} can be localized within a group as usual.
== Different typefaces ==


Navigation menu