Open main menu

Changes

m
minor adjustments, nothing new
= How to use one of the provided fonts: 4 steps, 10 sec. =__NOTOC__
; #1. First, be aware of have a look at the [[ConTeXt distribution's Fonts|21 provided fonts provided]] and their "nickname".the associated typescript name:
; #2. Give a name to = Change the set of fonts you want to use and select a first font:* Use used in the command {{cmd|definefontfamily}}.:* Let's take an example, for a Serif font, for which TeX practice is to refer to them as '''roman''' (document =rm):* <texcode>\definefontfamily[MyFontIdentifier][rm][nickname of the serif font]</texcode>
; #3To change the font used in the entire document (including headers and footers), use {{cmd|setupbodyfont}} and the associated [[ConTeXt distribution's Fonts|typescript name]]. Declare it as your  : <texcode>\setupbodyfont[thetypescriptname]</texcode> By default , the font is used at 11pt. To change the font family for your documentsize, specify the font size with the the typescript name. For example, to switch to 10pt, use: :* Use <texcode>\setupbodyfont[typescriptname, 10pt]</texcode> By default, the command with serif (or roman) style of the 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[MyFontIdentifiertypescriptname, ss, 12pt]</texcode>
; #4. 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{Upright: The quick brown fox jumps over the lazy dog\unknown}\bold{Bold: The quick brown fox \unknown}\italic{\bf Italic: The quick brown fox jumps over the lazy dog\unknown}\\bolditalic{\it Bolditalic: The quick brown fox jumps over the lazy dog\unknown}\\stoplines
</context>
|
And let's add view the two lines, using difference with Tex Gyre Pagella Serif font (ref:texgyrepagella):
<context source=yes>
\definefontfamily setupbodyfont[MyFontIdentifier] [rm] [texgyrepagellapagella,10pt] \setupbodyfont[MyFontIdentifier]startlines\setupbodyfont[12pt]normal{Upright: The quick brown fox jumps over the lazy dog\unknown}\bold{Bold: The quick brown fox \unknown}\italic{\bf Italic: The quick brown fox jumps over the lazy dog\unknown}\\bolditalic{\it 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>:* '''!!! WARNING !!!, ''', it's not the '''typescript name''' that we have to use more than one , but the '''family name''' of the provided 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> ; #2. For the other fonts, just continue to add them to your font family. :* '''ss''' for Sans Serif, '''tt''' for TypewriTer, '''mm''' for MatheMatics. <texcode>\definefontfamily[MyFontIdentifier][ss][familynameofthesansseriffont]\definefontfamily[MyFontIdentifier][tt][familynameofthemonospacedfont]\definefontfamily[MyFontIdentifier][mm][familynameofthemathfont]</texcode>: 1 step* 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}}, 5 secas you would do for a typescript. =<texcode>\setupbodyfont[MyFontIdentifier]</texcode>
; #1. Very similarly to above, just add more font in your font family.
:* for a Sans Serif font, for which TeX practice is to refer to them as '''Sans Serif''' (=ss)
:* <texcode>\definefontfamily[MyFontIdentifier][ss][refcode to the sans serif font]</texcode>
:* for a monospaced font, for which TeX practice is to refer to them as '''TypewriTer''' (=tt)
:* <texcode>\definefontfamily[MyFontIdentifier][tt][refcode to the monospaced font]</texcode>
:* for a math font, for which TeX practice is to refer to them as '''MatheMatics''' (=mm)
:* <texcode>\definefontfamily[MyFontIdentifier][mm][refcode to the math font]</texcode>
:* the limit is that in TeX practice, we only have one roman, one sans serif, per font family.
:* in order to use more (like variation condensed, extralight etc...) we have to define other font family (MyFontIdentifier-condensed, MyFontIdentifier-light)
== Example ==
 
{{TwoColumnsUnderLevel1
|
This basic input is typeset with the default font, Latin Modern:
<context source=yes>
        \setupbodyfont[12pt7pt]{\rm startbuffer[line]The quick brown fox jumps over the lazy dog}\stopbuffer \startbuffer[sample]\startTABLE \NC \type{\rmnormal} \NC \bf The quick brown fox jumps over the lazy dognormal{\getbuffer[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{\ssbolditalic} \bf The quick brown fox jumps over the lazy dogNC \bolditalic{\getbuffer[line]} \NC \NR\stopTABLE\stopbuffer \startlines\type{\ss\it The quick brown fox jumps over the lazy dogserif}\serif{\getbuffer[sample]} \type{\sans}\sans{\tt The quick brown fox jumps over the lazy doggetbuffer[sample]} \type{\mono}\mono{\tt\bf The quick brown fox jumps over the lazy doggetbuffer[sample]} \type{\math}\math{x = \ttfrac{y}{2z} + x_{\it The quick brown fox jumps over the lazy dogtext{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>
\definefontfamily [MyFontIdentifier] [rm] [texgyrepagella]\definefontfamily [MyFontIdentifier] [ss] [texgyreadventor]\definefontfamily [MyFontIdentifier] [tt] [texgyrecursor]\setupbodyfontdefinefontfamily [MyFontIdentifier] [mm] [stixtwomath]\setupbodyfont[12ptMyFontIdentifier, 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{\ssbolditalic} \NC \bolditalic{\bf The quick brown fox jumps over the lazy doggetbuffer[line]} \NC \NR\stopTABLE\stopbuffer \startlines\type{\ss\it The quick brown fox jumps over the lazy dogserif}\serif{\getbuffer[sample]} \type{\sans}\sans{\tt The quick brown fox jumps over the lazy doggetbuffer[sample]} \type{\mono}\mono{\tt\bf The quick brown fox jumps over the lazy doggetbuffer[sample]} \type{\math}\math{x = \ttfrac{y}{2z} + x_{\it The quick brown fox jumps over the lazy dogtext{center}}}\\stoplines
</context>
}}
 
 
[[Category:Fonts]]