Difference between revisions of "Simple Typescript Example"
Jump to navigation
Jump to search
Line 121: | Line 121: | ||
Annotations: | Annotations: | ||
* A thrid typescript is defined named ''[nimbus]'' | * A thrid typescript is defined named ''[nimbus]'' | ||
− | * usetypescript calls the ''typescript | + | * usetypescript calls the ''typescript [nimbus]'' in which the ''typeface [nimbus]'' is defined |
− | * ''typeface [nimbus]'' and ''typescript [nimbus | + | * ''typeface [nimbus]'' and ''typescript [nimbus]'' are two totally different things |
− | * | + | * if the ''typescript [nimbus]'' would not be called via usetypescript then the ''typeface [nimbus]'' would not be defined |
==References== | ==References== |
Revision as of 16:48, 21 August 2010
(not finished now)
Task
To map Nimbus Sans on rm-fonts and Nimbus Serif on ss-fonts.
Requirements
The Nimbus Sans and Nimbus Serif fonts are installed at your System and also recognized by ConTeXt. If
mtxrun --script fonts --list --all --pattern=nimbus*
does not shows you minimum:
nimbusromno9lmedi nimbusromno9lmedi utmb8a.afm nimbusromno9lmedibold nimbusromno9lmedi utmb8a.afm nimbusromno9lmediital nimbusromno9lmediital utmbi8a.afm nimbusromno9lregu nimbusromno9lregu utmr8a.afm nimbusromno9lreguital nimbusromno9lreguital utmri8a.afm nimbusromno9lregunormal nimbusromno9lregu utmr8a.afm nimbussanlbold nimbussanlbold uhvb8a.afm nimbussanlboldital nimbussanlboldital uhvbo8a.afm nimbussanlregu nimbussanlregu uhvr8a.afm nimbussanlreguital nimbussanlreguital uhvro8a.afm nimbussanlregunormal nimbussanlregu uhvr8a.afm
please visit the instruction how to install fonts to MkIV.
You do not have to use this Nimbus fonts. For this example you can use any Unicode font you like. If you use different fonts do not forget to exchange the font names in the example script below.
Script
\enableregime[utf] \setupencoding[default=uc] \setupcapitals[sc=yes] \starttypescript [serif] [nimbus] \definefontsynonym [Serif] [name:nimbussanlregu] \definefontsynonym [SerifBold] [name:nimbussanlbold] \definefontsynonym [SerifItalic] [name:nimbussanlreguital] \definefontsynonym [SerifSlanted] [name:nimbussanlreguital] \definefontsynonym [SerifBoldItalic] [name:nimbussanlboldital] \definefontsynonym [SerifBoldSlanted] [name:nimbussanlboldital] \definefontsynonym [SerifCaps] [name:nimbussanlregu] \stoptypescript \starttypescript [sans] [nimbus] \definefontsynonym [Sans] [name:nimbusromno9lregu] \definefontsynonym [SansBold] [name:nimbusromno9lbold] \definefontsynonym [SansItalic] [name:nimbusromno9lreguital] \definefontsynonym [SansSlanted] [name:nimbusromno9lreguital] \definefontsynonym [SansBoldItalic] [name:nimbusromno9lboldital] \definefontsynonym [SansBoldSlanted] [name:nimbusromno9lboldital] \definefontsynonym [SansCaps] [name:nimbusromno9lregu] \stoptypescript \definetypeface [nimbus] [rm] [serif] [nimbus] \definetypeface [nimbus] [ss] [sans] [nimbus] \setupbodyfont[nimbus,rm,10pt] \starttext Regular {\it Italic} {\bf Bold} {\bi Bold-Italic} {\sc KaPiTaLe} \showbodyfont \stoptext
Annotations:
- The first two lines say:
- We only enter unicode
- We only use unicode fonts
- Thirds line (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.
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 the fonts are mapped to the different font styles.
Small extension
We extend the script a litte:
... \definefontsynonym [SansCaps] [name:nimbusromno9lregu] \stoptypescript \starttypescript [nimbus] \definetypeface [nimbus] [rm] [serif] [nimbus] \definetypeface [nimbus] [ss] [sans] [nimbus] \stoptypescript \usetypescript[nimbus] \setupbodyfont[nimbus,rm,10pt] \starttext ...
Annotations:
- A thrid typescript is defined named [nimbus]
- usetypescript calls the typescript [nimbus] in which the typeface [nimbus] is defined
- typeface [nimbus] and typescript [nimbus] are two totally different things
- if the typescript [nimbus] would not be called via usetypescript then the typeface [nimbus] would not be defined
References
- setupbodyfont
- showbodyfont
- definetypeface (not found in the references)
- starttypescript / stoptypescript (not found in the references)
- definefontsynonym (not found in the references)