Changes

Jump to navigation Jump to search
m
no edit summary
[[Category:Fonts]]
(not finished now)==Overview==
==Task== To 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 \stoptext</texcode> Both scripts (serif and sans nimbus) map the fonts names to the different (existing) font style. Usage is implemented as follows:
* The {\it Italic{cmd|setupbodyfont}} command calls the ''typeface nimbus''.* The ''typeface nimbus'' calls the ''typescript [serif][nimbus]'' for {{cmd|rm}} fonts, or ''typescript [sans][nimbus]'' for the {{cmd|ss}}fonts.
{\bf Bold}The scripts then map the fonts to different font styles.
{\bi Bold-Italic}==Extension==
{\sc KaPiTaLe}The fonts can be changed by extending the script:
<texcode>...\showbodyfontdefinefontsynonym [SansCaps] [name:nimbusromno9lregu]\stoptypescript
% Define a typescript named nimbus.\starttypescript [nimbus] \definetypeface [nimbus] [rm] [serif] [nimbus] \stoptextdefinetypeface [nimbus] [ss] [sans] [nimbus]</texcode>\stoptypescript
Annotations:* The first two lines say: ** We only enter unicode ** We only use unicode fonts* Thirds line (setupcapitals) say ConTeXt to use % Use the Capital Letters defined in nimbus typescript, which defines the fonts* Two scripts are defined:nimbus typeface.*# the scripts named ''[serif]\usetypescript[nimbus]'' and*# the script named ''[sans]\setupbodyfont[nimbus,rm,10pt]''* 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.
The chain starts with setupbodyfont: it calls the ''typeface nimbus''\starttext.. 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 the fonts are mapped to the different font styles.</texcode>
==Small extension==Note that ''typeface [nimbus]'' and ''typescript [nimbus]'' are different.
Calling {{cmd|usetypescript}}[nimbus] ensures that the two {{cmd|definetypeface}} commands, embedded within {{cmd|starttypescript}}, as shown above, are called:
\definetypeface [nimbus] [rm] [serif] [nimbus]
\definetypeface [nimbus] [ss] [sans] [nimbus]
==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