Changes

Jump to navigation Jump to search
m
no edit summary
[[Category:Fonts]]
==Task==
To ==Overview== This page describes how to map Nimbus a Sans on rm-fonts Serif font to the {{cmd|ss}} command and Nimbus a Serif on ss-fontsfont to the {{cmd|rm}} command. This 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 shows 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 fonts. For this example you can use any Unicode a different 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]
\setupencoding[default=uc]
% Enable Capital Letter use
\setupcapitals[sc=yes]
% Define a script named [serif][nimbus]\starttypescript [serif] [nimbus] \definefontsynonym [Serif] [name:nimbussanlregunimbusromno9lregu] \definefontsynonym [SerifBold] [name:nimbussanlboldnimbusromno9lbold] \definefontsynonym [SerifItalic] [name:nimbussanlreguitalnimbusromno9lreguital] \definefontsynonym [SerifSlanted] [name:nimbussanlreguitalnimbusromno9lreguital] \definefontsynonym [SerifBoldItalic] [name:nimbussanlbolditalnimbusromno9lboldital] \definefontsynonym [SerifBoldSlanted] [name:nimbussanlbolditalnimbusromno9lboldital] \definefontsynonym [SerifCaps] [name:nimbussanlregunimbusromno9lregu]
\stoptypescript
% Define a second script named [sans][nimbus]\starttypescript [sans] [nimbus] \definefontsynonym [Sans] [name:nimbusromno9lregunimbussanlregu] \definefontsynonym [SansBold] [name:nimbusromno9lboldnimbussanlbold] \definefontsynonym [SansItalic] [name:nimbusromno9lreguitalnimbussanlreguital] \definefontsynonym [SansSlanted] [name:nimbusromno9lreguitalnimbussanlreguital] \definefontsynonym [SansBoldItalic] [name:nimbusromno9lbolditalnimbussanlboldital] \definefontsynonym [SansBoldSlanted] [name:nimbusromno9lbolditalnimbussanlboldital] \definefontsynonym [SansCaps] [name:nimbusromno9lregunimbussanlregu]
\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]
\starttext
Regular , {\it Italic} , {\bf Bold} , {\bi Bold-Italic} , {\sc KaPiTaLe}
\showbodyfont
</texcode>
Annotations:* The first two lines say: ** We only enter unicode ** We only use unicode fonts* Thirds line Both scripts (setupcapitals) say ConTeXt to use the Capital Letters defined in the fonts* Two scripts are defined:*# the scripts named ''[serif][nimbus]'' and*# the script named ''[sans][nimbus]''* Both scripts ) map the fonts names to the different (existing) font style.* Both definetypeface-lines define the typeface ''nimbus''. The first defines the rm-fonts and the second the ss-fonts. * setupbodyfont says to ConTeXt witch typeface to use with which parameters.Usage is implemented as follows:
* The chain starts with {{cmd|setupbodyfont: it }} command calls the ''typeface nimbus''. Then the * The ''typeface nimbus''# calls the ''typescript [serif][nimbus]'' for the {{cmd|rm-}} fonts# calls the , or ''typescript [sans][nimbus]'' for the {{cmd|ss-fonts.And inside these scripts the }} fonts are mapped to the different font styles.
==Small extension==The scripts then map the fonts to different font styles.
To show how to call a typescript directly we extend ==Extension== The fonts can be changed by extending the script a litte:
<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 thrid 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==
* [[Reference/enCommand/setupbodyfont|setupbodyfont]]* [[Reference/enCommand/showbodyfont|showbodyfont]]
* definetypeface (not found in the references)
* starttypescript / stoptypescript (not found in the references)
* definefontsynonym (not found in the references)
419

edits

Navigation menu