Changes

Jump to navigation Jump to search
2,047 bytes added ,  12:39, 11 September 2014
How to use the \definefontfamily command
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
<tr>
</tr>
</table>
 
== Description ==
 
== Example ==
 
In the first example we create a new typeface with the name `mainface` which includes fonts from the TeX Gyre family. Even though there is no math used in this example it is better to set one because math symbols are sometimes used in text mode.
 
<context mode="mkiv" source="yes" text="produces">
\definefontfamily [mainface] [rm] [TeX Gyre Pagella]
\definefontfamily [mainface] [ss] [TeX Gyre Heros]
\definefontfamily [mainface] [mm] [TeX Gyre Pagella Math]
 
\setupbodyfont[mainface]
 
\starttext
\rm Serif: TeX Gyre Pagella
 
\ss Sans: TeX Gyre Heros
\stoptext
</context>
 
In this example we are switching the fonts which are used for the upright, italic etc. alternatives. With the help of the `style` keyword you access one of the predefined styles, by default `\definefontfamily` uses the following styles for each alternative:
 
{|
! Alternative !! Style
|-
| tf || regular
|-
| it || italic
|-
| sl || slanted
|-
| bf || bold
|-
|bi || bolditalic
|-
| sc || smallcaps
|}
 
<context mode="mkiv" source="yes" text="produces">
\definefontfamily[changedstyles][rm][TeX Gyre Pagella][tf=style:italic,it=style:bold,bf=style:bolditalic,bi=style:regular]
 
\setupbodyfont[pagella]
 
\starttext
\rm\tf Regular, \it Italic, \bf Bold and \bi BoldItalic.
 
\switchtobodyfont[changedstyles]
 
\rm\tf Regular, \it Italic, \bf Bold and \bi BoldItalic.
</context>
 
<context mode="mkiv" source="yes" text="produces">
\definefontfamily[changedfiles][rm][TeX Gyre Pagella][it=file:texgyreherositalic,bi=file:texgyrecursorbolditalic]
 
\setupbodyfont[changedfiles]
 
\starttext
\tf Regular, \it Italic, \bf Bold and \bi BoldItalic.
</context>
 
<context mode="mkiv" source="yes" text="produces">
\definefontfamily[changedfeatures][rm][TeX Gyre Pagella][tf=features:smallcaps,bf=features:none]
 
\setupbodyfont[pagella]
 
\starttext
\tf ffi, \it ffi, \bf ffi, \bi ffi.
 
\switchtobodyfont[changedfeatures]
 
\tf ffi, \it ffi, \bf ffi, \bi ffi.
\stoptext
</context>
 
== See also ==
 
* {{cmd|definetypeface}}
* {{cmd|definefallbackfamily}}
gardener
110

edits

Navigation menu