Changes

Jump to navigation Jump to search
m
no edit summary
[[Category:Fonts]]
== Overview ==
This page describes how to map Nimbus a Sans Serif font to the {{cmd|ss}} fonts command and Nimbus a Serif font to the {{cmd|rm}} fonts at 10.0ptcommand. Here, `ss` means Sans Serif and `rm` means RomanThis page also describes how typefaces differ from typescripts.
==Requirements==
The This example uses Nimbus Sans and , which is a GPL font. Check whether Nimbus Serif fonts are installed at your System and also recognized is available by ConTeXt. If running the following command:
mtxrun --script fonts --list --all --pattern=nimbus*
does not show you minimumThis should reveal a list similar to the following:
nimbusromno9lmedi nimbusromno9lmedi utmb8a.afm
nimbussanlregunormal nimbussanlregu uhvr8a.afm
please visit If the instruction [[Fonts_in_LuaTeX#Building_the_font_database|how font is not shown, you might have to install fonts to MkIV]].the font, which can be found on some systems at:
/usr/share/fonts/type1/gsfonts You do not have to may use this Nimbus a different font. For this example you can use any Unicode font you like. If you use different ; please see [[Fonts_in_LuaTeX#Building_the_font_database|how to install fonts do not forget to exchange the font names in the example script belowMkIV]] for details.
==Script==
 
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