Changes

Jump to navigation Jump to search
m
no edit summary
==Overview==
This page describes how to map a Sans Serif font to the {{cmd|ss}} command and a Serif font to the {{cmd|rm}} command. This page also describes how typefaces differ from typescripts.
==Requirements==
This example uses Nimbus, which is a GPL font. Check to see if whether Nimbus is available by running the following command:
mtxrun --script fonts --list --all --pattern=nimbus*
==Script==
The ConTeXt code to configure the Configure a font follows:
<texcode>
% Enable Unicode fonts
\enableregime[utf]
 
% Enable Capital Letter use
\setupcapitals[sc=yes]
% Define a script named [serif][nimbus]
\starttypescript [serif] [nimbus]
\definefontsynonym [Serif] [name:nimbusromno9lregu]
\stoptypescript
% Define a second script named [sans][nimbus]
\starttypescript [sans] [nimbus]
\definefontsynonym [Sans] [name:nimbussanlregu]
\stoptypescript
% Define the typeface nimbus; use serif for rm-fonts, sans serif for ss-fonts.
\definetypeface [nimbus] [rm] [serif] [nimbus]
\definetypeface [nimbus] [ss] [sans] [nimbus]
% Indicate the typeface to use.
\usetypescript[nimbus][uc]
\setupbodyfont[nimbus,rm,10pt]
</texcode>
Annotations:* The first two lines say: ** We only enter unicode ** We only use unicode fonts* Thirds line Both scripts (setupcapitalsserif and sans nimbus) say ConTeXt map the fonts names to use the Capital Letters defined in the fontsdifferent (existing) font style. Usage is implemented as follows:* Two scripts are defined:*# The {{cmd|setupbodyfont}} command calls the scripts named ''[serif][typeface nimbus]'' and.*# The ''typeface nimbus'' calls the script named ''typescript [sansserif][nimbus]''* Both scripts map the for {{cmd|rm}} fonts names to the different (existing) font style.* Both definetypeface-lines define the typeface , or ''typescript [sans][nimbus]''. The first defines the rm-fonts and the second for the {{cmd|ss-}} fonts. * setupbodyfont says to ConTeXt witch typeface to use with which parameters.
The chain starts with setupbodyfont: it calls the ''typeface nimbus''. Then the ''typeface nimbus''# calls the ''typescript [serif][nimbus]'' for the rm-fonts# calls the ''typescript [sans][nimbus]'' for the ss-fonts.And inside these scripts then map the fonts are mapped to the different font styles.
==Small extensionExtension==
To show how to call a typescript directly we extend The fonts can be changed by extending the script a little:
<texcode>
\stoptypescript
% Define a typescript named nimbus.
\starttypescript [nimbus]
\definetypeface [nimbus] [rm] [serif] [nimbus]
\stoptypescript
% Use the nimbus typescript, which defines the nimbus typeface.
\usetypescript[nimbus]
\setupbodyfont[nimbus,rm,10pt]
</texcode>
Annotations:* A third typescript is defined named Note that ''typeface [nimbus]''* usetypescript calls the and ''typescript [nimbus]'' in which the ''typeface are different.  Calling {{cmd|usetypescript}}[nimbus]'' is definedensures that the two {{cmd|definetypeface}} commands, embedded within {{cmd|starttypescript}}, as shown above, are called: * ''typeface \definetypeface [nimbus]'' and ''typescript [rm] [serif] [nimbus]'' are two totally different things* if the ''typescript \definetypeface [nimbus]'' would not be called via usetypescript then the ''typeface [ss] [sans] [nimbus]'' would not be defined
==References==
419

edits

Navigation menu