# Changes

,  08:35, 7 June 2020
m
minor adjustments, nothing new
First, have a look at the [[ConTeXt distribution's Fonts|21 provided fonts]] and the associated typescript name:
= Use one Change the provided fontsfont used in the document = To change the font used in the entire document (including headers and footers), use {{cmd|setupbodyfont}} and the associated [[ConTeXt distribution's Fonts|typescript name]]. : <texcode>\setupbodyfont[thetypescriptname]</texcode> By default, the font is used at 11pt. To change the font size, specify the font size with the the typescript name. For example, to switch to 10pt, use: : <texcode>\setupbodyfont[typescriptname, 10pt]</texcode> By default, out the serif (or roman) style of the box =font is used. To switch to sans serif style, add <code>ss</code> to {{cmd|setupbodyfont}}: : <texcode>\setupbodyfont[typescriptname, ss]</texcode> These options can be combined. So, to get sans serif font at 12pt, use: : <texcode>\setupbodyfont[typescriptname, ss, 12pt]</texcode>
; #1. Declare the font you want to use for your document with {{cmd|setupbodyfont}} and the associated [[ConTeXt distribution's Fonts|typescript name]].
:* <texcode>\setupbodyfont[thetypescriptname]</texcode>
; #2. Specify the font size
:* <texcode>\setupbodyfont[xxpt]</texcode>
To learn how to use different alternative styles of a given font, like regular / bold / italic, see the [[Font_Switching]] in the [[Basics]].
Let see what give the defaults:
<context source=yes>
\setupbodyfont[12pt10pt]
\startlines\normal{\rm Upright: The quick brown fox jumps over the lazy dog\unknown}\\bold{\it Bold: The quick brown fox jumps over the lazy dog\unknown}\\italic{\bf Italic: The quick brown fox jumps over the lazy dog\unknown}\\bolditalic{\bi Bolditalic: The quick brown fox jumps over the lazy dog\unknown}\\stoplines
</context>
|
And let's view the difference with Tex Gyre Pagella Serif font:
<context source=yes>
\setupbodyfont[12ptpagella,10pt] \setupbodyfont[pagella]startlines\normal{\rm Upright: The quick brown fox jumps over the lazy dog\unknown}\\bold{\it Bold: The quick brown fox jumps over the lazy dog\unknown}\\italic{\bf Italic: The quick brown fox jumps over the lazy dog\unknown}\\bolditalic{\bi Bolditalic: The quick brown fox jumps over the lazy dog\unknown}\\stoplines
</context>
}}

You can switch to any other font with {{cmd|switchtobodyfont}}.
= How to mix the provided fonts =
; #1. With {{cmd|definefontfamily}}, give a name to the set of fonts you want to use, and indicate a first font.
:* Let's start with a Serif font, for which TeX practice is to refer to them as '''rm''' for Roman
<texcode>\definefontfamily[MyFontIdentifier][rm][familynameoftheseriffont]</texcode>:* here'''!!! WARNING !!!, ''', it's not the '''typescript name''' that we have to use, but the '''family name''' of the font
:** see under each [[ConTeXt distribution's Fonts|preview in the overview table]]
:** or use <code>mtxrun --script font --list --file -pattern=*typescriptname*</code> like <code>mtxrun --script font --list --file -pattern=*pagella*</code>
<texcode>\definefontfamily[MyFontIdentifier][rm][familynameoftheseriffont]</texcode>
; #2. For the other stylesfonts, just continue to add more fonts them to your font family.
:* '''ss''' for Sans Serif, '''tt''' for TypewriTer, '''mm''' for MatheMatics.
<texcode>
\definefontfamily[MyFontIdentifier][mm][familynameofthemathfont]
</texcode>
:* As you see, a limit here is that in TeX practice, we only have one roman, one sans serif... per font family.
:* in order to use more fonts, like width variation ("condensed",...), and weight variation ("light",...), we have to define other font family (MyFontIdentifier-condensed, MyFontIdentifier-light), and to switch between them along the document, with {{cmd|switchtobodyfont}}.
; #3. Declare your font family as the default for your document with {{cmd|setupbodyfont}}, as you would do for a typescript.
== Example ==

{{TwoColumnsUnderLevel1
|
This basic input is typeset with the default font, Latin Modern:
<context source=yes>
\setupbodyfont[12pt]
{  \setupbodyfont[7pt]\rm startbuffer[line]The quick brown fox jumps over the lazy dog}\stopbuffer \startbuffer[sample]\startTABLE \NC \type{\rmnormal} \NC \normal{\bf The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\rmitalic} \NC \italic{\it The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\bold} \NC \bold{\ss The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\ss\bf The quick brown fox jumps over the lazy dogbolditalic} \NC \bolditalic{\ssgetbuffer[line]} \it The quick brown fox jumps over the lazy dog}NC \NR\stopTABLE\stopbuffer \startlines\type{\tt The quick brown fox jumps over the lazy dogserif}\serif{\getbuffer[sample]} \type{\tt\bf The quick brown fox jumps over the lazy dogsans}\sans{\getbuffer[sample]} \type{\tt\it The quick brown fox jumps over the lazy dogmono}\mono{\getbuffer[sample]} \type{\math}Inline \math: ${x = \frac{y}{2z} + x_{\text{center}}$\}\stoplines
</context>
|
And by adding let's view the two lines discussed above, and using the reference to Tex Gyre Pagella Serif font (texgyrepagella) we obtaindifference with our new set of fonts:
<context source=yes>
\setupbodyfont[12pt]\definefontfamily [MyFontIdentifier] [rm] [texgyrepagella]\definefontfamily [MyFontIdentifier] [ss] [texgyreadventor]\definefontfamily [MyFontIdentifier] [tt] [texgyrecursor]\definefontfamily [MyFontIdentifier] [mm] [stixtwomath]\setupbodyfont[MyFontIdentifier, 7pt]{\rm startbuffer[line]The quick brown fox jumps over the lazy dog}\stopbuffer \startbuffer[sample]\startTABLE \NC \type{\rmnormal} \NC \normal{\bf The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\rmitalic} \NC \italic{\it The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\bold} \NC \bold{\ss The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR \NC \type{\ss\bf The quick brown fox jumps over the lazy dogbolditalic} \NC \bolditalic{\ssgetbuffer[line]} \it The quick brown fox jumps over the lazy dog}NC \NR\stopTABLE\stopbuffer \startlines\type{\tt The quick brown fox jumps over the lazy dogserif}\serif{\getbuffer[sample]} \type{\tt\bf The quick brown fox jumps over the lazy dogsans}\sans{\getbuffer[sample]} \type{\tt\it The quick brown fox jumps over the lazy dogmono}\mono{\getbuffer[sample]} \type{\math}Inline \math: ${x = \frac{y}{2z} + x_{\text{center}}$\}\stoplines
</context>
}}
:* the limit is that in TeX practice, we only have one roman, one sans serif... per font family.[[Category:* in order to use more (like width variation like "condensed", or weight variation like "light" etc...) we have to define other font family (MyFontIdentifier-condensed, MyFontIdentifier-light)Fonts]]