summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex')
-rw-r--r--Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex1856
1 files changed, 1856 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex b/Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex
new file mode 100644
index 00000000000..6458f285754
--- /dev/null
+++ b/Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex
@@ -0,0 +1,1856 @@
+\startcomponent co-fonts
+% we assume that there are fontfiles demofont.afm/pfb
+%
+% runtools mfonts.rb
+
+% \loadmapfile[texnansi-test-test.map]
+
+\environment contextref-env
+\product contextref
+
+% some typescript examples
+
+\startbuffer[funny]
+\definetypeface [funny] [rm] [serif] [palatino] [default] [encoding=texnansi]
+\definetypeface [funny] [ss] [sans] [palatino] [default] [encoding=texnansi]
+\definetypeface [funny] [tt] [mono] [palatino] [default] [encoding=texnansi]
+\definetypeface [funny] [mm] [math] [palatino] [default] [encoding=texnansi]
+\stopbuffer
+
+\startbuffer[joke]
+\definetypeface [joke] [rm] [serif] [times] [default] [encoding=texnansi]
+\definetypeface [joke] [ss] [sans] [helvetica] [default] [rscale=.9,
+ encoding=texnansi]
+\definetypeface [joke] [tt] [mono] [courier] [default] [rscale=1.1,
+ encoding=texnansi]
+\definetypeface [joke] [mm] [math] [times] [default] [encoding=texnansi]
+\stopbuffer
+
+\startbuffer[nojoke]
+\definetypeface [nojoke] [rm] [serif] [times] [default] [encoding=texnansi]
+\definetypeface [nojoke] [ss] [sans] [helvetica] [default] [encoding=texnansi]
+\definetypeface [nojoke] [tt] [mono] [courier] [default] [encoding=texnansi]
+\definetypeface [nojoke] [mm] [math] [times] [default] [encoding=texnansi]
+\stopbuffer
+
+\startbuffer[whow]
+\definetypeface [whow] [rm] [serif] [modern] [latin-modern] [encoding=ec]
+\definetypeface [whow] [ss] [sans] [modern] [latin-modern] [encoding=ec]
+\definetypeface [whow] [tt] [mono] [modern] [latin-modern] [encoding=ec]
+\definetypeface [whow] [mm] [math] [modern] [latin-modern] [encoding=ec]
+\stopbuffer
+
+\getbuffer[funny,nojoke,joke,whow]
+
+\chapter[fonts]{Fonts}
+\index{font+definition}
+\section{Introduction}
+\index{fonts}
+
+This chapter will cover the details of defining fonts and collections of fonts, and it
+will explain how to go about installing fonts in both \MKII\ and \MKIV. It helps if
+you know what a font is, and are familiar with the \CONTEXT\ font switching macros.
+
+The original \CONTEXT\ font model was based on plain \TEX, but evolved into a more
+extensive one primarily aimed at consistently typesetting \PRAGMA's educational
+documents. The fact that pseudo caps had to be typeset in any font shape in the
+running text as well as superscripts, has clearly determined the design. The font
+model has been relatively stable since 1995.
+
+Currently there are three layers of font definitions:
+
+\startitemize
+
+\item simple font definitions: such definitions provide
+ \type {\named} access to a specific font in a
+ predefined size
+
+\item body font definitions: these result in a coherent
+ set of fonts, often from a same type foundry or
+ designer, that can be used intermixed as a \quote{style}
+
+\item typescript definitions: these package serif, sans serif,
+ mono spaced and math and other styles in such a way
+ that you can conveniently switch between different
+ combinations
+
+\stopitemize
+
+These three mechanisms are actually build on top of each
+other and all rely on a low level mapping mechanism
+that is responsible for resolving the real font file name
+and the specific font encoding used.
+
+When \TEX\ users install one of the \TEX\ distributions, like \TEX-live,
+automatically a lot of fonts will be installed on their system.
+Unfortunately it is not that easy to get a clear picture of what fonts
+are there and what is needed to use them. And although the \type {texmf}
+tree is prepared for commercial fonts, adding newly bought fonts is not
+trivial. To compensate this, \CONTEXT\ \MKII\ comes with
+\type{texfont.pl}, a program that can install fonts for you. And if the
+global setup is done correctly, \MKIV\ and \XETEX\ can use the fonts
+installed in your operation system without the need for extra
+installation work.
+
+\section {Font files and synonyms}
+\macro{\tex{definefontsynonym}}
+
+
+In \CONTEXT, whenever possible you should define symbolic names for fonts.
+The mapping from such symbolic names onto real font names can be done such
+that it takes place unnoticed for the user. This is good since the name
+depends on the encoding and therefore not seldom is obscure and hard to
+remember. The trick is knowing how to use the \type{\definefontsynonym}
+command.
+
+\placefloat[][]{none}{\showsetup{definefontsynonym}}
+
+The first argument is the synonym that is being defined or redefined.
+Redefinition is not only allowed but often very useful. The second
+argument is the replacement of the synonym. This replacement can be a
+real font name, but it can also be another synonym. The optional third
+argument can be used for to specify font settings.
+
+There is no limit on the number of indirection levels, but the last one
+in the chain has to be a valid font name. \CONTEXT\ knows it has reached
+the bottom level when there is no longer any replacement possible.
+
+Font settings actually take place at the bottom level, since they are
+closely related to specific instances of fonts. Any settings that are
+defined higher up in the chain perculate down, unless they are already
+defined at the lower level.
+
+\startbuffer[synonymargs]
+\vskip 1ex
+\starttabulate[|lT|p|]
+\NC encoding \NC The font file encoding for \TFM-based (\MKII) fonts.\NC \NR
+\NC handling \NC The font handling for \MKII\ (see previous chapter).\NC \NR
+\NC features \NC The font handling for \MKIV\ and \XETEX\ (see previous chapter).\NC \NR
+\NC mapping \NC letter case change mapping for \MKII\ that may be used in special
+ cases; never actually used in the \CONTEXT\ core.
+ See~\in{chapter}[languages] on languages for details.\NC \NR
+\stoptabulate
+\vskip 1ex
+\stopbuffer
+
+\getbuffer[synonymargs]
+
+Here is an example of the use of font synonyms:
+
+\startexample
+\starttyping
+\definefontsynonym [Palatino] [uplr8t] [encoding=ec]
+\stoptyping
+\stopexample
+
+In this example, the argumnet \type{uplr8t} is the real font (the actual
+file name is \type{uplr8t.tfm}, but file extensions are normally
+omitted), and it contains the metrics for the Type~1 font URW Palladio L
+in EC encoding. From now on, the name \type{Palatino} can be used in
+further font definitions to identify this font, instead of the
+dreadfully low||level (and hard to remember) name \type{uplr8t} and its
+accompanying encoding.
+
+A note on font names: In \PDFTEX, the real font is the name of the \TEX\ metrics file,
+minus the extension, as we saw already. In \XETEX\ and \MKIV\ a font name is a bit
+more complex, because in both cases OpenType fonts can be accessed directly by their
+official font name (but with any embedded spaces stripped out) as well as via the disk
+file name.
+
+In these two systems, \CONTEXT\ first attempts to find the font using the
+official font name. If that doesn't work, then it tries to use the font by
+file name as a fallback. Since this is not very efficient and also because
+it may generate |<|harmless, but alarming looking|>| warnings it is possible to
+force \CONTEXT\ into one or the other mode by using a prefix, so you will
+most often see synonym definitions like this:
+
+\startexample
+\starttyping
+\definefontsynonym [MSTimes] [name:TimesNewRoman] [features=default]
+\definefontsynonym [Iwona-Regular] [file:Iwona-Regular] [features=default]
+\stoptyping
+\stopexample
+
+In \XETEX, the \type{file} prefix implies that \XETEX\ will search for an
+OpenType font (with extension \type{otf} or \type{ttf}) and if that fails
+it will try to find a \TEX\ font (with extension \type{tfm}). In \MKIV, the
+list is a little longer: OpenType (\type{otf}, \type{ttf}), Type~1
+(\type{afm}), \OMEGA\ (\type{ofm}), and finally \TEX\ (\type{tfm}).
+
+The use of aliases to hide the complexity of true font names is already
+very useful, but \CONTEXT\ goes further than that. An extra synonym level
+is normally defined that attaches this font name to a generic name like
+\type{Serif} or \type{Sans}.
+
+\startexample
+\starttyping
+\definefontsynonym [Serif] [Palatino]
+\stoptyping
+\stopexample
+
+An important advantage of using names like \type {Serif} in macro and
+style definitions is that it can easily be remapped onto a completely
+different font than \type{Palatino}. This is often useful when you are
+experimenting with a new environment file for a book or when you are
+writing a \CONTEXT\ module.
+
+In fact, inside an environment file it is useful to go even further and
+define new symbolic names that map onto \type {Serif}.
+
+\starttyping
+\definefontsynonym [TitleFont] [Serif]
+\stoptyping
+
+By using symbolic names in the main document and in style and macro
+definitions, you can make them independent of a particular font and let
+them adapt automatically to the main document fonts. That is of course
+assuming these are indeed defined in terms of \type{Serif}, \type{Sans},
+etcetera. All the \CONTEXT\ predefined typescripts are set up this way, and
+you are very much encouraged to stick to the same logic for your own font
+definitions as well.
+
+The list of \quote{standard} symbolic names is given
+in~\in{table}[tab:symbolic font names]
+
+\startbuffer[symfontnames]
+\vskip 1ex
+\starttabulate[|lT|lT|l|]
+\NC \rm\bf name \NC \rm \bf style, alternative \NC \rm \bf explanation \NC \NR
+\NC Blackboard \NC -- \NC Used by the \type{\bbd} macro \NC \NR
+\NC Calligraphic \NC -- \NC Used by the \type{\cal} macro \NC \NR
+\NC Fraktur \NC -- \NC Used by the \type{\frak} macro \NC \NR
+\NC Gothic \NC -- \NC Used by the \type{\goth} macro \NC \NR
+\NC OldStyle \NC -- \NC Used by the \type{\os} macro \NC \NR
+\NC MPtxtfont \NC -- \NC The default font for \METAPOST \NC \NR
+\NC Calligraphy \NC cg,tf \NC \NC \NR
+\NC Handwriting \NC hw,tf \NC \NC \NR
+\NC MathRoman(Bold) \NC mm,mr(bf)\NC \NC \NR
+\NC MathItalic(Bold) \NC mm,mi(bf)\NC \NC \NR
+\NC MathSymbol(Bold) \NC mm,sy(bf)\NC \NC \NR
+\NC MathExtension(Bold) \NC mm,ex(bf)\NC \NC \NR
+\NC MathAlpha(Bold) \NC mm,ma(bf)\NC \NC \NR
+\NC MathBeta(Bold) \NC mm,mb(bf)\NC \NC \NR
+\NC MathGamma(Bold) \NC mm,mc(bf)\NC \NC \NR
+\NC MathDelta(Bold) \NC mm,md(bf)\NC \NC \NR
+\NC Mono \NC tt,tf \NC \NC \NR
+\NC MonoBold \NC tt,bf \NC \NC \NR
+\NC MonoItalic \NC tt,it \NC \NC \NR
+\NC MonoBoldItalic \NC tt,bi \NC \NC \NR
+\NC MonoSlanted \NC tt,sl \NC \NC \NR
+\NC MonoBoldSlanted \NC tt,bs \NC \NC \NR
+\NC MonoCaps \NC tt,sc \NC \NC \NR
+\NC Sans \NC ss,tf \NC \NC \NR
+\NC SansBold \NC ss,bf \NC \NC \NR
+\NC SansItalic \NC ss,it \NC \NC \NR
+\NC SansBoldItalic \NC ss,bi \NC \NC \NR
+\NC SansSlanted \NC ss,sl \NC \NC \NR
+\NC SansBoldSlanted \NC ss,bs \NC \NC \NR
+\NC SansCaps \NC ss,sc \NC \NC \NR
+\NC Serif \NC rm,tf \NC \NC \NR
+\NC SerifBold \NC rm,bf \NC \NC \NR
+\NC SerifItalic \NC rm,it \NC \NC \NR
+\NC SerifBoldItalic \NC rm,bi \NC \NC \NR
+\NC SerifSlanted \NC rm,sl \NC \NC \NR
+\NC SerifBoldSlanted \NC rm,bs \NC \NC \NR
+\NC SerifCaps \NC rm,sc \NC \NC \NR
+\stoptabulate
+\vskip 1ex
+\stopbuffer
+
+\placetable
+ [here]
+ [tab:symbolic font names]
+ {Standard symbolic font names, and the style||alternative pair they belong to.}
+ {\getbuffer[symfontnames]}
+
+
+As mentioned earlier, the items in the third argument of
+\type{\definefontsynonym} perculate down the chain of
+synonyms. Occasionally, you may want to splice some settings into that
+chain, and that is where \type{\setupfontsynonym} comes in handy.
+
+\showsetup{setupfontsynonym}
+
+For example, the predefined \MKII\ typescripts for font handling that we saw in
+the previous chapter contain a sequence of commands like this:
+
+\startexample
+\starttyping
+\setupfontsynonym [Serif] [handling=pure]
+\setupfontsynonym [SerifBold] [handling=pure]
+\setupfontsynonym [SerifItalic] [handling=pure]
+....
+\stoptyping
+\stopexample
+
+\section {Simple font definitions}
+\macro{\tex{definefont}}
+\macro{\tex{definedfont}}
+
+The most simple font definition takes place with \type {\definefont}.
+
+\showsetup{definefont}
+
+This macro defines a font with the same name as the first argument and
+you can use its name as an identifier to select that font. The second
+argument works in the same way as the second argument to
+\type{\definefontsynonym}: you can use either a font synonym or a real
+font. There is an optional third argument that can be either a bare
+number like \type{1.5 }, or a named setup
+(see~\in{section}[sec:setups]). In case of a bare number, that is a local
+setting for the interline space. In case of a setup, that setup can do
+whatever it wants.
+
+\startbuffer [dingbat]
+\loadmapfile [koeieletters]
+\definefont [ContextLogo] [koeielogos at 72pt]
+\ContextLogo \char 2
+\stopbuffer
+
+For instance:
+
+\startexample
+\typebuffer[dingbat]
+\stopexample
+
+will result in
+
+\startreality
+\getbuffer[dingbat]
+\stopreality
+
+If you want a fixed size font like in the example above, you can define a
+font using the primitive \TEX\ \type {at} or \type {scaled} modifiers.
+
+Be warned that \type {at} is often useful, but \type {scaled} is somewhat
+unreliable since it scales the font related to its internal design size,
+and that is often unknown. Depending on the design size is especially
+dangerous when you use symbolic names, since different fonts have
+different design sizes, and designers differ in their ideas about what a
+design size is. Compare for instance the 10pt instance of a Computer
+Modern Roman with Lucida Bright (which more looks like a 12pt then).
+
+\starttyping
+\definefont [TitleFont] [Serif scaled 2400]
+\stoptyping
+
+Hardcoded sizes can be useful in many situations, but they can be
+annoying when you want to define fonts in such a way that their
+definitions adapt themselves to their surroundings. That is why
+\CONTEXT\ provides an additional way of scaling:
+
+\starttyping
+\definefont [TitleFont] [Serif sa 2.4]
+\stoptyping
+
+The \type {sa} directive means as much as \quote {scaled at
+the body font size}. Therefore this definition will lead to
+a 24pt scaling when the (document) body font size equals
+10pt. Because the definition has a lazy nature, the font
+size will adapt itself to the current body font size.
+
+There is an extra benefit to using \type{sa} instead of \type{at}.
+Instead of a numeric multiplier, you can also use the identifiers that
+were defined in the body font environment that specified the related
+dimensions. For example, this scales the font to the \type {b} size,
+being 1.440 by default:
+
+\starttyping
+\definefont [TitleFont] [Serif sa b]
+\stoptyping
+
+In fact, if you use a bare name like in
+
+\starttyping
+\definefont [TitleFont] [Serif]
+\stoptyping
+
+it will internally be converted to
+
+\starttyping
+\definefont [TitleFont] [Serif sa *]
+\stoptyping
+
+which in turn expands into the current actual font size, after the
+application of size corrections for super|| and subscripts etc.
+
+For example
+
+\startbuffer[saex]
+\definefont [TitleFont] [Sans]
+{\TitleFont test} and {\tfc \TitleFont test}
+\stopbuffer
+
+\startexample
+\typebuffer[saex]
+\stopexample
+
+gives
+
+\startreality
+\getbuffer[saex]
+\stopreality
+
+A specialized alternative to \type {sa} that is sometimes useful is \type
+{mo}. Here the size maps onto to body font size only after it has passed
+through an optional size remapping. Such remappings are defined by the
+macro \type{\mapfontsize}:
+
+\showsetup{mapfontsize}
+
+Such remapping before applying scaling is sometimes handy for math fonts,
+where you may want to use slightly different sizes than the ones given in
+the body font environment. In the \CONTEXT\ distribution, this happens
+only with the Math Times fonts, where the predefined typescript contains
+the following lines:
+
+\starttyping
+\mapfontsize [5pt] [6.0pt]
+\mapfontsize [6pt] [6.8pt]
+\mapfontsize [7pt] [7.6pt]
+\mapfontsize [8pt] [8.4pt]
+\mapfontsize [9pt] [9.2pt]
+\mapfontsize [10pt] [10pt]
+\mapfontsize [11pt] [10.8pt]
+\mapfontsize [12pt] [11.6pt]
+\mapfontsize [14.4pt] [13.2pt]
+\stoptyping
+
+As we have seen, \type{\definefont} creates a macro name for a font
+switch. For ease of use, there is also a direct method to access a
+font:
+
+\showsetup{definedfont}
+
+Where the argument has exactly the same syntax as the second argument to
+\type{\definefont}. In fact, this macro executes \type{\definefont}
+internally, and then immediately switches to the defined font.
+
+
+\section {Defining body fonts}
+\macro{\tex{definebodyfont}}
+
+
+In older versions of \CONTEXT, the model for defining fonts that will be
+described in this section was the top||level user interface. These days,
+typescripts are used at the top||level, and the body font definitions are
+wrapped inside of those.
+
+Most commercial fonts have only one design size, and when you create a
+typescript for such fonts, you can simply reuse the predefined size
+definitions. Later on we will see that this means you can just refer to a
+\type{default} definition.
+
+Still, you may need (or want) to know the details of body font definitions
+if you create your own typescripts, especially if the fonts are not all
+that standard. For example, because Latin Modern comes in design sizes,
+there was a need to associate a specific font with each bodyfont size. You
+may find yourself in a similar situation when you attempt to create a
+typescript for a \quote{professional} commercial font set.
+
+The core of this intermediate model is the \type{\definebodyfont} command
+that is used as follows:
+
+\starttyping
+\definebodyfont [10pt] [rm] [tf=tir at 10pt]
+\stoptyping
+
+This single line actually defines two font switches \type{\tf} for use
+after a \type{\rm} command, and \type{\rmtf} for direct access.
+
+\blank
+
+As one can expect, the first implementation of a font model in \TEX\ is
+also determined and thereby complicated by the fact that the Computer
+Modern Roman fonts come in design sizes. As a result, definitions can look
+rather complex and because most \TEX\ users start with those fonts, font
+definitions are considered to be complex.
+
+Another complicating factor is that in order to typeset math, even more
+(font) definitions are needed. Add to that the fact that sometimes fonts
+with mixed encodings have to be used, i.e.\ with the glyphs positioned in
+different font slots, and you can understand why font handling in \TEX\
+is often qualified as \quote {the font mess}. Flexibility simply has its
+price.
+
+Like most other \TEX\ users, Hans Hagen started out using the Computer
+Modern Roman fonts. Since these fonts have specific design sizes,
+\CONTEXT\ supports extremely accurate \type{\definebodyfont} definitions with
+specific font names and sizes for each combination. The following is an
+example of that:
+
+\startbuffer[font-6]
+\definebodyfont [12pt] [rm]
+ [ tf=cmr12,
+ tfa=cmr12 scaled \magstep1,
+ tfb=cmr12 scaled \magstep2,
+ tfc=cmr12 scaled \magstep3,
+ tfd=cmr12 scaled \magstep4,
+ bf=cmbx12,
+ it=cmti12,
+ sl=cmsl12,
+ bi=cmbxti10 at 12pt,
+ bs=cmbxsl10 at 12pt,
+ sc=cmcsc10 at 12pt]
+\stopbuffer
+
+\typebuffer[font-6]
+
+It should be clear to you that for fonts with design sizes, similar
+\type{\definebodyfont} commands will have to be written for each of the
+requested body font sizes. But many commercial fonts do not come in
+design sizes at all. In fact, many documents have a rather simple design
+and use only a couple of fonts for all sizes.
+
+The previous example used the available \TEX||specifications \type {scaled}
+and \type {at}, but (as we say already) \CONTEXT\ supports special keyword
+that is a combination of both: \type {sa} (scaled at).
+
+For example, for the Helvetica Type~1 font definition we could define:
+
+\startbuffer[font-7]
+\definebodyfont [12pt] [ss]
+ [tf=hv sa 1.000,
+ bf=hvb sa 1.000,
+ it=hvo sa 1.000,
+ sl=hvo sa 1.000,
+ tfa=hv sa 1.200,
+ tfb=hv sa 1.440,
+ tfc=hv sa 1.728,
+ tfd=hv sa 2.074,
+ sc=hv sa 1.000]
+\stopbuffer
+
+\typebuffer[font-7]
+
+The scaling is done in relation to the bodyfont size. In analogy with
+\TEX's \type {\magstep} we can use \type {\magfactor}: instead of \type
+{sa 1.440} we could specify \type {sa \magfactor2}.
+
+If you are happy with the relative sizes as defined in the body font
+environment (and there is no reason not to), the \type{\definebodyfont}
+can be four lines shorter. That is because \CONTEXT\ predeclares a whole
+collection of names that combine the styles \type{rm}, \type{ss}, \type{tt},
+\type{tf}, \type{hw} and \type{cg} with the alternatives \type{bf},
+\type{it}, \type{sl}, \type{bi}, \type{bs}, and \type{sc} with the
+postfixes \type{a}, \type{b}, \type{c}, \type{d}, \type{x} and \type{xx}.
+
+For the combination of \type{ss} and \type{sl}, the following identifiers
+are predeclared:
+
+\starttyping
+\ss \ssa \ssb \ssc \ssd \ssx \ssxx
+\sl \sla \slb \slc \sld \slx \slxx
+\sssl \sssla \ssslb \ssslc \sssld
+\stoptyping
+
+
+And because there are no more sizes in the definition any more, we can
+just as well combine all of the requested sizes in a single
+\type{\definebodyfont} by using a list of sizes as the first
+argument. This means exactly the same as repeating that whole list five
+(or more) times, but saves a lot of typing:
+
+\starttyping
+\definebodyfont [12pt,11pt,10pt,9pt,8pt] [ss]
+ [tf=hv sa 1.000,
+ bf=hvb sa 1.000,
+ it=hvo sa 1.000,
+ sl=hvo sa 1.000,
+ sc=hv sa 1.000]
+\stoptyping
+
+Because the font names (may) depend on the encoding vector, we had better
+use the previously discussed method for mapping symbolic names. So, any one
+of the three following lines can be used, but the third one is best:
+
+\starttyping
+\definebodyfont [10pt,11pt,12pt] [ss] [tf=hv sa 1.000]
+\definebodyfont [10pt,11pt,12pt] [ss] [tf=Helvetica sa 1.000]
+\definebodyfont [10pt,11pt,12pt] [ss] [tf=Sans sa 1.000]
+\stoptyping
+
+
+And in the actual \CONTEXT\ core, the default body fonts are in fact
+defined with commands like this:
+
+\startbuffer[font-5]
+\definebodyfont [default] [rm]
+ [ tf=Serif sa 1,
+ ...
+ it=SerifItalic sa 1,
+ ... ]
+\stopbuffer
+
+\typebuffer[font-5]
+
+We saw that \type {\tf} is the default font. Here \type {\tf} is defined as
+\typ{Serif sa 1} which means that it is a serif font, scaled to a normal
+font size. This \type {Serif} is mapped elsewhere on for example \typ
+{Palatino} which in turn is mapped on the actual filename \type {uplr8t},
+as demonstrated earlier.
+
+\showsetup{definebodyfont}
+
+The macro syntax for \type{\definebodyfont} is a bit abbreviated. Besides
+the two||letter keys that are listed for the third argument, it is also
+possible to assign values to font identifiers with the alphabetic suffixes
+\type{a} through \type{d} like \type{tfa} as well as the ones with an
+\type{x} or \type{xx} suffix like \type{bfx}. You can even define totally new
+keywords, if you want that.
+
+As an example we will define a bigger fontsize of \type {\tf}:
+
+\startbuffer
+\definebodyfont [10pt,11pt,12pt] [rm]
+ [tfe=Serif at 48pt,
+ ite=SerifItalic at 48pt]
+\tfe Big {\it Words}.
+\stopbuffer
+
+\startexample
+\typebuffer
+\stopexample
+
+This becomes:
+
+\startreality
+\startlinecorrection
+\getbuffer
+\stoplinecorrection
+\stopreality
+
+Note that there is a small trick here: the assignment to \type{ite} is
+needed for the command \type{\it} to work properly. Without that, the
+command \type{\it} would run the \quote{normal} version of \type{it} and
+that has a size of 11pt.
+
+
+The keywords \type{mr}, \type {ex}, \type {mi}, \type {sy}, \type {ma},
+\type {mb},\type {mc} and \type{md} all relate to math families. As was
+already hinted at in~\in{table}[tab:symbolic font names], these have
+extended relatives suffixed by \type{bf} for use within bold math
+environments.
+
+Calls of \type{\definebodyfont} for the \type{mm} style look quite
+different from the other styles, because they set up these special
+keywords, and nothing else. The first four keys are required in all math
+setups just to do basic formula typesetting, the other four (\type{ma}
+\dots \type{md}) can be left undefined. Those are normally used for fonts
+with special symbols or alphabets like the AMS symbol fonts \type{msam}
+and \type{msbm}.
+
+Here is what a setup for a fairly standard \type{mm} could look like:
+
+\startexample
+\starttyping
+\definebodyfont [10pt] [mm]
+ [mr=cmr10,
+ ex=cmex10,
+ mi=cmmi10,
+ sy=cmsy10]
+
+\definebodyfont [17.3pt,14.4pt,12pt,11pt,10pt,9pt] [mm]
+ [ma=msam10 sa 1,
+ mb=msbm10 sa 1]
+\stoptyping
+\stopexample
+
+The keys \type{mc} and \type{md} are left undefined. This example
+explicitly shows how multiple \type{\definebodyfont}s are combined by
+\CONTEXT\ automatically and that there is no need to do everything
+within a single definition (in fact this was already implied by the
+\type{tfe} trick above.)
+
+Apart from the calling convention as given in the macro syntax that has
+already been shown, there are a few alternative forms of
+\type{\definebodyfont} that can be used to defined and call body fonts by
+name:
+
+\showsetup{definebodyfontDEF}
+
+This was used in the default serif font defintion shown above: the first
+argument to \type{\definebodyfont} was the identifier \type{default}
+because these definitions were to be used from within other definitions.
+
+An actual size will be provided by the commands at the top||level in the
+calling chain, the third argument in that \type{\definebodyfont} call will
+also be \type{default} instead of actually specifying settings.
+
+\showsetup{definebodyfontREF}
+
+The use of the \type{default} actually happens deep inside \CONTEXT\ so
+there is clear code that can be shown, but if it was written out, a call
+would for example look like this:
+
+\startexample
+\starttyping
+\definebodyfont
+ [17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt]
+ [rm,ss,tt,mm]
+ [default]
+\stoptyping
+\stopexample
+
+To end this section: for advanced \TEX\ users there is the
+dimension||register \type {\bodyfontsize}. This variable can be used to set
+fontwidths. The number (rounded) points is available in \type
+{\bodyfontpoints}.
+
+This way of defining fonts has been part of \CONTEXT\ from
+the beginning, but as more complicated designs started to
+show up, we felt the need for a more versatile mechanism.
+
+\section {Typescripts and typefaces}
+
+\macro{\tex{usetypescript}}
+\macro{\tex{usetypescriptfile}}
+\macro{\tex{starttypescript}}
+\macro{\tex{definetypeface}}
+
+On top of the existing traditional font module, \CONTEXT\ now provides a
+more abstract layer of typescripts and building blocks for definitions
+and typefaces as font containers. The original font definition files have
+been regrouped into such typescripts thereby reducing the number of files
+involved.
+
+As we saw earlier, \quote{using} a typescript is done via the a call to the
+macro \type{\usetypescript}. Here is the macro syntax setup again:
+
+\showsetup{usetypescript}
+
+Typescripts are in fact just organized definitions, and \quote{using} a
+typescript therefore actually means nothing more than executing the set of
+definitions that is contained within a particular typescript.
+
+The main defining command for typescripts is a start||stop pair that wraps
+the actual macro definitions.
+
+\starttyping
+\starttypescript [...] [...] [...]
+ ....
+\stoptypescript
+\stoptyping
+
+As with \type{\usetypescript}, there can be up to three arguments, and
+these two sets of arguments are linked to eachother: the values of the
+first and second argument in the call to \type{\starttypescript} of
+
+\startexample
+\starttyping
+\starttypescript [palatino] [texnansi,ec,qx,t5,default]
+ ...
+\stoptypescript
+\stoptyping
+\stopexample
+
+are what make the \MKII-style call to \type{\usetypescript}
+
+\startexample
+\starttyping
+\usetypescript [palatino] [ec]
+...
+\stoptyping
+\stopexample
+
+possible and meaningful: the first argument in both cases is the same so
+that this matches, and the second argument of \type{\usetypescript} appears
+in the list that is the second argument of \type{\starttypescript}, so this
+also matches. \CONTEXT\ will execute all matching blocks it knows about:
+there may be more than one.
+
+To perform the actual matching, \CONTEXT\ scans through the list of known
+\type{\starttypescript} blocks for each of the combinations of items in
+the specified arguments of \type{\usetypescript}. These blocks can be
+preloaded definitions in \TEX's memory, or they may come from a file.
+
+There is a small list of typescript files that is tried always, and by
+using \type{\usetypescriptfile} you actually add extra ones at the end of
+this list.
+
+The automatically loaded files for the three possible engines are,
+in first to last order:
+
+\starttabulate[|lT|lT|lT|p|]
+\NC \rmbf pdftex \NC \rmbf xetex \NC \rmbf luatex \NC \rmbf explanation \NC \FR
+\NC type-tmf \NC type-tmf \NC type-tmf \NC Core \TEX\ community fonts\NC \NR
+\NC type-siz \NC type-siz \NC type-siz \NC Font size setups\NC \NR
+\NC type-one \NC \NC \NC Type~1 free fonts\NC \NR
+\NC \NC type-otf \NC type-otf \NC OpenType free fonts\NC \NR
+\NC \NC type-xtx \NC \NC MacOSX font support\NC \NR
+\NC type-akb \NC \NC \NC Basic Adobe Type~1 mappings\NC \NR
+\NC type-loc \NC type-loc \NC type-loc \NC A user configuration file\NC \NR
+\stoptabulate
+
+Extra arguments to \type{\usetypescript} are ignored, and that is why that
+same two-argument call to \type{\usetypescript} works correctly in \MKIV\
+as well, even tough the typescript itself uses only a single argument:
+
+\startexample
+\starttyping
+\starttypescript [palatino]
+ ...
+\stoptypescript
+\stoptyping
+\stopexample
+
+On the other hand, extra arguments to \type{\starttypescript} are not
+ignored: a \type{\starttypescript} with two specified arguments will not
+be matched by a \type{\usetypescript} that has only one specified
+argument.
+
+However, you can force any key at all to match by using the special
+keyword \type{all} in your \type{\usetypescript} or
+\type{\starttypescript}. We will see later that this use of a
+wildcard is sometimes handy.
+
+
+\subsection{A typescript in action}
+
+Before we can go on and explain how to write \type{\starttypescript}
+blocks, we have to step back for a moment to the macro
+\type{\definetypeface}, and especially to the third, fourth and fifth
+argument:
+
+\startexample
+\starttyping
+\starttypescript [palatino] [texnansi,ec,qx,t5,default]
+\definetypeface[palatino] [rm] [serif] [palatino] [default]
+...
+\stoptyping
+\stopexample
+
+Remember how in the previous chapter there were the tables that listed all
+the predefined combinations? It was said there that these \quote{\dots are
+nothing more than convenience names that are attached to a group of fonts
+by the person that wrote the font definition}.
+
+Here is how that works: these arguments of \type{\definetypeface} are
+actually used as parts of \type{\usetypescript} calls. To be preciese,
+inside the macro definition of \type{\definetypeface}, there are the
+following lines:
+
+\startexample
+\starttyping
+\def\definetypeface
+ ...
+ \usetypescript[#3,map][#4][name,default,\typefaceencoding,special]
+ \usetypescript[#3][#5][size]
+ ...
+\stoptyping
+\stopexample
+
+In our example \type{#3} is \type{serif}, \type{#4} is \type{palatino},
+and \type{#5} is default. The value of \type{\typefaceencoding} is
+inherited from the calling \type{\usetypescript}. That means that the two
+lines expand into:
+
+\starttyping
+\usetypescript[serif,map][palatino] [name,default,ec,special]
+\usetypescript[serif][default][size]
+\stoptyping
+
+And those typescripts will be searched for. This example is using \MKII,
+so the list of typescript files is \type{type-tmf}, \type{type-siz},
+\type{type-one}, \type{type-akb}, and \type{type-loc}. The first two
+arguments of \type{\usetypescript} are handled depth first, so first all
+\quote{serif} typescripts are tried against all the files in the list and
+then all the \quote{map} typescripts.
+
+Not all of the seached typescript blocks are indeed present in the list
+of files that have to be scanned, but a few are, and one apparently even
+more than once:
+
+\starttabulate[|lT|l|l|l|]
+\NC type-tmf.tex \NC serif \NC palatino \NC name \NC\NR
+\NC type-one.tex \NC serif \NC palatino \NC texnansi,ec,8r,t5 \NC\NR
+\NC type-one.tex \NC serif \NC palatino \NC ec,texnansi,8r \NC\NR
+\NC type-one.tex \NC map \NC all \NC -- \NC\NR
+\NC type-siz.tex \NC serif \NC default \NC size \NC\NR
+\stoptabulate
+
+All of the found blocks are executed, so let's look at them in order
+
+\starttyping
+\starttypescript [serif] [palatino] [name]
+ \definefontsynonym [Serif] [Palatino]
+ \definefontsynonym [SerifBold] [Palatino-Bold]
+ \definefontsynonym [SerifItalic] [Palatino-Italic]
+ \definefontsynonym [SerifSlanted] [Palatino-Slanted]
+ \definefontsynonym [SerifBoldItalic] [Palatino-BoldItalic]
+ \definefontsynonym [SerifBoldSlanted] [Palatino-BoldSlanted]
+ \definefontsynonym [SerifCaps] [Palatino-Caps]
+\stoptypescript
+\stoptyping
+
+This block has mapped the standard symbolic names to names in the
+\quote{Palatino} family, one of the standard font synonym actions as
+explained in the beginning of this chapter.
+
+\starttyping
+\starttypescript [serif] [palatino] [texnansi,ec,8r,t5]
+\definefontsynonym [Palatino]
+ [\typescriptthree-uplr8a] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-Italic]
+ [\typescriptthree-uplri8a] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-Bold]
+ [\typescriptthree-uplb8a] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-BoldItalic]
+ [\typescriptthree-uplbi8a] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-Slanted]
+ [\typescriptthree-uplr8a-slanted-167] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-BoldSlanted]
+ [\typescriptthree-uplb8a-slanted-167] [encoding=\typescriptthree]
+\definefontsynonym [Palatino-Caps]
+ [\typescriptthree-uplr8a-capitalized-800] [encoding=\typescriptthree]
+
+\loadmapfile[\typescriptthree-urw-palatino.map]
+\stoptypescript
+\stoptyping
+
+This maps the Palatino names onto the actual font files. Some further
+processing is taking place here: the calling \type{\usetypescript} that
+was called from within the \type{\definetypeface} knows that it wants
+\type{ec} encoding. Because this is the third argument, it becomes the
+replacement of \type{\typescriptthree}. The body of the typescript
+therefore reduces to:
+
+\begingroup
+\hfuzz10pt
+\starttyping
+\definefontsynonym[Palatino] [ec-uplr8a] [encoding=ec]
+\definefontsynonym[Palatino-Italic] [ec-uplri8a] [encoding=ec]
+\definefontsynonym[Palatino-Bold] [ec-uplb8a] [encoding=ec]
+\definefontsynonym[Palatino-BoldItalic] [ec-uplbi8a] [encoding=ec]
+\definefontsynonym[Palatino-Slanted] [ec-uplr8a-slanted-167] [encoding=ec]
+\definefontsynonym[Palatino-BoldSlanted][ec-uplb8a-slanted-167] [encoding=ec]
+\definefontsynonym[Palatino-Caps] [ec-uplr8a-capitalized-800][encoding=ec]
+
+\loadmapfile[ec-urw-palatino.map]
+\stoptyping
+\endgroup
+
+Incidentally, this also loads a font map file. In earlier versions of \CONTEXT, this
+was done by separate typescripts in the file \type{type-map.tex}, but nowadays all map
+loading is combined with the definition of the synonyms that link to the true fonts on
+the harddisk. This way, there is a smaller chance of errors creeping
+in. See~\in{section}[sec:map files] for more details on font map files.
+
+The third match is a block that sets sets up \quote{TeXPalladioL} font synonyms. These
+will not actually be used, but it is a match so it will be executed anyway.
+
+\starttyping
+\starttypescript [serif] [palatino] [ec,texnansi,8r]
+\definefontsynonym[TeXPalladioL-BoldItalicOsF]
+ [\typescriptthree-fplbij8a][encoding=\typescriptthree]
+...
+\stoptypescript
+\stoptyping
+
+The next matched entry loads the font map files for the default fonts:
+
+\starttyping
+\starttypescript [map] [all]
+ \loadmapfile[original-base.map]
+ \loadmapfile[original-ams-base.map]
+\stoptypescript
+\stoptyping
+
+this will not really be needed for the palatino \type{\rm} typescript, but it ensures
+that even if there is something horribly wrong with the used typescripts, at least
+\PDFTEX\ will be able to find the Latin Modern (the default font set) on the
+harddisk.
+
+The last match is the missing piece of the font setup:
+
+\starttyping
+\starttypescript [serif] [default] [size]
+ \definebodyfont
+ [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
+ [rm] [default]
+\stoptypescript
+\stoptyping
+
+and now the typescript is complete.
+
+As explained earlier, that last block references a named
+\type{\definebodyfont} that is defined in \type{type-unk.tex}:
+
+\starttyping
+\definebodyfont [default] [rm]
+ [tf=Serif sa 1,
+ bf=SerifBold sa 1,
+ it=SerifItalic sa 1,
+ sl=SerifSlanted sa 1,
+ bi=SerifBoldItalic sa 1,
+ bs=SerifBoldSlanted sa 1,
+ sc=SerifCaps sa 1]
+\stoptyping
+
+similar \type{default} blocks are defined for the other five font styles also.
+
+Looking back, you can see that the Palatino-specific typescripts did
+actually do anything except definining font synonyms, loading a map file,
+and calling a predefined \type{bodyfont}.
+
+\subsection{Some more information}
+
+As we saw already, typescripts and its invocations have up to three specifiers. An
+invocation matches the script specification when the three arguments have common
+keywords, and the special keyword \type {all} is equivalent to any match.
+
+Although any keyword is permitted in any of the three arguments, the
+current definitions (and macros like \type{\definetypeface}) make heavy
+use of some keys in particular:
+
+\starttabulate[|lT|p|]
+\HL
+\NC \bf pattern \NC \bf application \NC \NR
+\HL
+\NC [serif] [*] [*] \NC serif fonts \NC \NR
+\NC [sans] [*] [*] \NC sans serif fonts \NC \NR
+\NC [mono] [*] [*] \NC mono spaced fonts \NC \NR
+\NC [math] [*] [*] \NC math fonts \NC \NR
+\NC [*] [*] [size] \NC size specifications \NC \NR
+\NC [*] [*] [name] \NC symbolic name mapping \NC \NR
+\NC [*] [*] [special] \NC special settings \NC \NR
+\NC [*] [all] [*] \NC default case(s) \NC \NR
+\NC [map] [*] [*] \NC map file specifications \NC \NR
+\HL
+\stoptabulate
+
+When you take a close look at the actual files in the distribution you
+will notice a quite a few other keywords. One in particular is worth
+mentioning: instead of the predefined sizes in \type {default}, you can
+use the \type {dtp} size scripts with their associated body font
+environments by using
+
+\starttyping
+\usetypescript [all] [dtp] [size]
+\stoptyping
+
+or
+
+\starttyping
+\definetypeface[palatino] [rm] [serif] [palatino] [dtp]
+\stoptyping
+
+\blank
+
+In the top||level typescript for the palatino, we had a bunch of
+\type{\definetypeface} commands, as follows:
+
+\typebuffer[funny]
+
+Once these commands are executed (wether or not as part of a typescript), \type
+{\funny} will enable this specific collection of fonts. In a similar way we can
+define a collection \type {\joke}.
+
+\typebuffer[joke]
+
+And the familiar Computer Modern Roman as \type {\whow}:
+
+\typebuffer[whow]
+
+
+\startbuffer[sample]
+Who is {\it fond} of fonts?
+Who claims that $t+e+x+t=m+a+t+h$?
+Who {\ss can see} {\tt the difference} here?
+\stopbuffer
+
+Now has become possible to switch between these three font collections at will.
+Here is a sample of some text and a little bit of math:
+
+\startexample
+\typebuffer[sample]
+\stopexample
+
+When typeset in \type {\funny}, \type {\joke}, and \type{whow}, the samples look like:
+
+\startlines
+{\funny \getbuffer[sample]}
+\stoplines
+
+\startlines
+{\joke \getbuffer[sample]}
+\stoplines
+
+\startlines
+{\whow \getbuffer[sample]}
+\stoplines
+
+With \type {\showbodyfont} you can get an overview of this font.
+
+\placefigure
+ {The \type {funny} typeface collection.}
+ {\showbodyfont[funny]}
+
+\placefigure
+ {The \type {joke} typeface collection.}
+ {\showbodyfont[joke]}
+
+\placefigure
+ {The \type {whow} typeface collection.}
+ {\showbodyfont[whow]}
+
+When defining the joke typeface collection, we used a scale
+directive. The next sample demonstrates the difference
+between the non scaled and the scaled alternatives.
+
+\startlines
+{\nojoke \getbuffer[sample]}
+\stoplines
+
+\startlines
+{\joke \getbuffer[sample]}
+\stoplines
+
+
+It may not be immediately clear from the previous examples, but a big
+difference between using typeface definitions and the old method of
+redefining over and over again, is that the new method uses more
+resources. This is because each typeface gets its own name space
+assigned. As an intentional side effect, the symbolic names also follow
+the typeface. This means that for instance:
+
+\startbuffer[big]
+\definefont[MyBigFont][Serif sa 1.5] \MyBigFont A bit larger!
+\stopbuffer
+
+\typebuffer[big]
+
+will adapt itself to the currently activated serif font
+shape, here \type {\funny}, \type {\joke} and \type {\whow}.
+
+\startlines
+{\funny \getbuffer[big]}
+{\joke \getbuffer[big]}
+{\whow \getbuffer[big]}
+\stoplines
+
+\subsection{A bit more about math}
+
+Math is kind of special in the sense that it has its own set
+of fonts, either or not related to the main text font. By
+default, a change in style, for instance bold, is applied to
+text only.
+
+\startbuffer[math]
+$ \sqrt{625} = 5\alpha$
+$\bf \sqrt{625} = 5\alpha$
+$ \sqrt{625} = \bf 5\alpha$
+$\bfmath \sqrt{625} = 5\alpha$
+\stopbuffer
+
+\typebuffer[math]
+
+The difference between these four lines is as follows:
+
+\startlines
+\funny \getbuffer[math]
+\stoplines
+
+In order to get a bold $\alpha$ symbol, we need to define bold math
+fonts. \footnote {Bold math is already prepared in the core modules, so
+normally one can do with less code} Assuming the font's typescripts
+support bold math, the most convenient way of doing this is the following:
+
+\startbuffer
+\definetypeface [whow] [mm]
+ [math,boldmath] [modern] [default] [encoding=texnansi]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Bold math looks like this:
+
+\startlines
+\whow \getbuffer[math]
+\stoplines
+
+The definitions are given on the next page. Such definitions are normally collected in
+the project bound file, for instance called \type {typeface.tex}, that is then manually
+added to the list of typescript files:
+
+\starttyping
+\usetypescriptfile[typeface] % project scripts
+\stoptyping
+
+%An example of such a file is shown below:
+
+%\start
+%\switchtobodyfont[9pt] \typefile{typeface}
+%\stop
+
+It is also possible to avoid typescripts. When definitions are
+used only once, it makes sense to use a more direct method.
+We will illustrate this with a bit strange example.
+
+Imagine that you want some math formulas to stand out, but
+that you don't have bold fonts. In that case you can for
+instance scale them. A rather direct method is the following.
+
+\startbuffer
+\definebodyfont
+ [funny]
+ [12pt,11pt,10pt,9pt,8pt,7pt] [mm]
+ [mrbf=MathRoman mo 2,
+ exbf=MathExtension mo 2,
+ mibf=MathItalic mo 2,
+ sybf=MathSymbol mo 2]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Our math sample will now look like:
+
+\startlines
+\funny \getbuffer[math]
+\stoplines
+
+We can also use an indirect method:
+
+\startbuffer
+\definebodyfont
+ [smallmath] [mm]
+ [mrbf=MathRoman mo .5,
+ exbf=MathExtension mo .5,
+ mibf=MathItalic mo .5,
+ sybf=MathSymbol mo .5]
+
+\definebodyfont
+ [funny]
+ [12pt,11pt,10pt,9pt,8pt,7pt]
+ [mm] [smallmath]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This method is to be preferred when we have to define more
+typefaces since it saves keystrokes.
+
+\startlines
+\funny \getbuffer[math]
+\stoplines
+
+For efficiency reasons, the font definitions (when part of
+a typeface) are frozen the first time they are used. Until
+that moment definitions will adapt themselves to changes in
+for instance scaling and (mapped) names. Freezing
+definitions is normally no problem because typefaces are
+defined for a whole document and one can easily define
+more instances. When you redefine it, a frozen font is
+automatically unfrozen.
+
+\section{Predefined font, style and alternative keywords}
+\macro{\tex{definebodyfontswitch}}
+\macro{\tex{definefontstyle}}
+\macro{\tex{definealternativestyle}}
+
+Some of the internal commands are worth mentioning because they define keywords and
+you may want to add to the list.
+
+Font size switching is done with keywords like \type{twelvepoint} and commands like
+\type {\twelvepoint} or \type {\xii}, which is comparable to the way it is done in
+plain \TEX. These commands are defined with:
+
+
+\startbuffer[font-10]
+\definebodyfontswitch [fourteenpointfour] [14.4pt]
+\definebodyfontswitch [twelvepoint] [12pt]
+\definebodyfontswitch [elevenpoint] [11pt]
+\definebodyfontswitch [tenpoint] [10pt]
+\definebodyfontswitch [ninepoint] [9pt]
+\definebodyfontswitch [eightpoint] [8pt]
+\definebodyfontswitch [sevenpoint] [7pt]
+\definebodyfontswitch [sixpoint] [6pt]
+\definebodyfontswitch [fivepoint] [5pt]
+\definebodyfontswitch [fourpoint] [4pt]
+\definebodyfontswitch [xii] [12pt]
+\definebodyfontswitch [xi] [11pt]
+\definebodyfontswitch [x] [10pt]
+\definebodyfontswitch [ix] [9pt]
+\definebodyfontswitch [viii] [8pt]
+\definebodyfontswitch [vii] [7pt]
+\definebodyfontswitch [vi] [6pt]
+\stopbuffer
+
+\typebuffer[font-10]
+
+But be warned that \type{\xi} is later redefined as a greek symbol.
+
+The keys in \type {\setupbodyfont} are defined in terms of:
+
+\startbuffer[font-11]
+\definefontstyle [rm,roman,serif,regular] [rm]
+\definefontstyle [ss,sansserif,sans,support] [ss]
+\definefontstyle [tt,teletype,type,mono] [tt]
+\definefontstyle [hw,handwritten] [hw]
+\definefontstyle [cg,calligraphic] [cg]
+\stopbuffer
+
+\typebuffer[font-11]
+
+In many command setups we encounter the parameter \type {style}. In those situations
+we can specify a key. These keys are defined with \type {\definealternativestyle}. The
+third argument is only of importance in chapter and section titles, where, apart from
+\type {\cap}, we want to obey the font used there.
+
+\startbuffer[font-12]
+\definealternativestyle [mediaeval] [\os] []
+\definealternativestyle [normal] [\tf] []
+\definealternativestyle [bold] [\bf] []
+\definealternativestyle [type] [\tt] []
+\definealternativestyle [mono] [\tt] []
+\definealternativestyle [slanted] [\sl] []
+\definealternativestyle [italic] [\it] []
+\definealternativestyle [boldslanted,
+ slantedbold] [\bs] []
+\definealternativestyle [bolditalic,
+ italicbold] [\bi] []
+\definealternativestyle [small,
+ smallnormal] [\tfx] []
+\definealternativestyle [smallbold] [\bfx] []
+\definealternativestyle [smalltype] [\ttx] []
+\definealternativestyle [smallslanted] [\slx] []
+\definealternativestyle [smallboldslanted,
+ smallslantedbold] [\bsx] []
+\definealternativestyle [smallbolditalic,
+ smallitalicbold] [\bix] []
+\definealternativestyle [sans,
+ sansserif] [\ss] []
+\definealternativestyle [sansbold] [\ss\bf] []
+\definealternativestyle [smallbodyfont] [\setsmallbodyfont] []
+\definealternativestyle [bigbodyfont] [\setbigbodyfont] []
+\definealternativestyle [cap,
+ capital] [\smallcapped] [\smallcapped]
+\definealternativestyle [smallcaps] [\sc] [\sc]
+\definealternativestyle [WORD] [\WORD] [\WORD]
+\stopbuffer
+
+\typebuffer[font-12]
+
+In \in{section}[emphasize] we have already explained how
+{\em emphasizing} is defined. With oldstyle digits this is
+somewhat different. We cannot on the forehand in what font
+these can be found. By default we have the setup:
+
+
+\startbuffer[font-13]
+\definefontsynonym [OldStyle] [MathItalic]
+\stopbuffer
+
+\typebuffer[font-13]
+
+As we see they are obtained from the same font as the math italic characters. The
+macro \type{\os} fetches the runtime setting by executing
+\type{\symbolicfont{OldStyle}}, which is just a low-level version of
+\type{\definedfont[OldStyle sa *]}. A few other macros behave just like that:
+
+\starttabulate[|lT|l|l|]
+\NC \rm\bf macro \NC \bf synonym \NC \bf default value \NC \NR
+\NC \tex{os} \NC OldStyle \NC MathItalic (lmmi10) \NC \NR
+\NC \tex{frak} \NC Fraktur \NC eufm10 \NC \NR
+\NC \tex{goth} \NC Gothic \NC eufm10 \NC \NR
+\NC \tex{cal} \NC Calligraphic \NC cmsy10 (lmsy10) \NC \NR
+\NC \tex{bbd} \NC Blackboard \NC msbm10 \NC \NR
+\stoptabulate
+
+In addition to all the alrady mentioned commands there are others, for example macros
+for manipulating accents. These commands are discussed in the file \type
+{font-ini}. More information can also be found in the file \type {core-fnt} and
+specific gimmicks in the file \type {supp-fun}. So enjoy yourself.
+
+\section {Symbols and glyphs}
+
+Some day you may want to define your own symbols, if
+possible in such a way that they nicely adapt themselves to
+changes in style and size. A good example are the \symbol
+[euro] symbols. You can take a look in \type {symb-eur.tex}
+to see how such a glyph is defined.
+
+\starttyping
+\definefontsynonym [EuroSerif] [eurose]
+\definefontsynonym [EuroSerifBold] [euroseb]
+...
+\definefontsynonym [EuroSans] [eurosa]
+\definefontsynonym [EuroSansBold] [eurosab]
+...
+\definefontsynonym [EuroMono] [euromo]
+\definefontsynonym [EuroMonoBold] [euromob]
+\stoptyping
+
+Here we use the free Adobe euro fonts, but there are
+alternatives available. The symbol itself is defined as:
+
+\starttyping
+\definesymbol [euro] [\getglyph{Euro}{\char160}]
+\stoptyping
+
+You may notice that we only use the first part of the
+symbolic name. \CONTEXT\ will complete this name according
+to the current style. You can now access this symbol with
+\typ {\symbol [euro]}
+
+\starttabulate[|l|c|c|c|c|c|c|]
+\NC \NC \tex{tf} \NC \tex{bf} \NC \tex{sl}
+ \NC \tex{it} \NC \tex{bs} \NC \tex{bi} \NC\NR
+\NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro
+ \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR
+\NC \ss Sans \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro
+ \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR
+\NC \tt Mono \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro
+ \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR
+\stoptabulate
+
+More details on defining symbols and symbol sets can be
+found in the documentation of the symbol modules.
+
+\section{Encodings}
+\macro{\tex{startencoding}}
+\macro{\tex{startmapping}}
+\macro{\tex{definecharacter}}
+\macro{\tex{defineaccent}}
+\macro{\tex{definecommand}}
+\macro{\tex{definecasemap}}
+
+\todo{Add macro syntax definition blocks}
+
+Until now we assumed that an~\type {a} will become an~a
+during type setting. However, this is not always the case.
+Take for example~\"a or~\ae. This character is not available
+in every font and certainly not in the Computer Modern
+Typefaces. Often a combination of characters \type {\"a} or a
+command \type {\ae} will be used to produce such a character.
+In some situation \TEX\ will combine characters
+automatically, like in \type {fl} that is combined to fl and
+not \hbox{f}\hbox{l}. Another problem occurs in converting
+small print to capital print and vice versa.
+
+Below you see an example of the \type {texnansi} mapping:
+
+
+\startbuffer[enco-1]
+\startmapping[texnansi]
+ \definecasemap 228 228 196 \definecasemap 196 228 196
+ \definecasemap 235 235 203 \definecasemap 203 235 203
+ \definecasemap 239 239 207 \definecasemap 207 239 207
+ \definecasemap 246 246 214 \definecasemap 214 246 214
+ \definecasemap 252 252 220 \definecasemap 220 252 220
+ \definecasemap 255 255 159 \definecasemap 159 255 159
+\stopmapping
+\stopbuffer
+
+\typebuffer[enco-1]
+
+This means so much as: in case of a capital the character
+with code 228 becomes character 228 and in case of small
+print the character becomes character 196.
+
+These definitions can be found in \type {enco-ans}. In this
+file we can also see:
+
+
+\startbuffer[enco-2]
+\startencoding[texnansi]
+ \defineaccent " a 228
+ \defineaccent " e 235
+ \defineaccent " i 239
+ \defineaccent " o 246
+ \defineaccent " u 252
+ \defineaccent " y 255
+\stopencoding
+\stopbuffer
+
+\startbuffer[enco-3]
+\startencoding[texnansi]
+ \definecharacter ae 230
+ \definecharacter oe 156
+ \definecharacter o 248
+ \definecharacter AE 198
+\stopencoding
+\stopbuffer
+
+\typebuffer[enco-2]
+
+and
+
+\typebuffer[enco-3]
+
+As a result of the way accents are placed over characters we
+have to approach accented characters different from normal
+characters. There are two methods: \TEX\ does the accenting
+itself {\em or} prebuild accentd glyphs are used. The
+definitions above take care of both methods. Other
+definitions are sometimes needed. In the documentation of
+the file \type {enco-ini} more information on this can be
+found.
+
+\section[sec:map files]{Map files}
+\macro{\tex{loadmapfile}}
+\macro{\tex{setupencoding}}
+
+\todo{This section is too informal}
+
+If you're already sick of reading about fonts, you probably
+don't want read this section. But alas, \DVI\ post processors
+and \PDFTEX\ will not work well if you don't provide them
+\type {map} files that tell them how to handle the files
+that contain the glyphs.
+
+In its simplest form, a definition looks as follows:
+
+\starttyping
+usedname < texnansi.enc < realname.pfb
+\stoptyping
+
+This means as much as: when you want to include a file that
+has the \type {tfm} file \type {usedname}, take the outline
+file \type {realname.pfb} and embed it with the \type
+{texnansi} encoding vector. Sometimes you need more
+complicated directives and you can leave that to the
+experts. We try to keep up with changes in the map file
+syntax, the names of fonts, encodings, locations in the
+\TEX\ tree, etc. However, it remains a troublesome area.
+
+It makes sense to take a look at the \type {cont-sys.rme} file
+to see what preferences make sense. If you want to speed up
+the typescript processing, say (in \type {cont-sys.tex}:
+
+\starttyping
+\preloadtypescripts
+\stoptyping
+
+If you want to change the default encoding, you should add
+something:
+
+\starttyping
+\setupencoding [default=texnansi]
+\stoptyping
+
+You can let \CONTEXT\ load the map files for \PDFTEX:
+
+\starttyping
+\autoloadmapfilestrue
+\stoptyping
+
+The following lines will remove existing references to map
+files and load a few defaults.
+
+\starttyping
+\resetmapfiles
+\loadmapfile[original-base.map]
+\loadmapfile[original-ams-base.map]
+\loadmapfile[original-public-lm.map]
+\stoptyping
+
+As said, map files are a delicate matter.
+
+\section{Installing fonts}
+
+\todo{Document use of \MKIV and \XETEX\ and in particular OSFONTDIR}
+
+Most \TEX\ distributions come with a couple of fonts, most
+noticeably the Computer Modern Roman typefaces. In order to
+use a font, \TEX\ has to know its characteristics. These are
+defined in \type {tfm} and \type {vf} files. In addition to
+these files, on your system you can find a couple of more
+file types.
+
+\starttabulate[|cT|lp|]
+\HL
+\NC \bf suffix \NC \bf content \NC \NR
+\HL
+\NC tfm \NC \TEX\ specific font metric files that, in
+ many cases, can be generated from \type {afm}
+ files \NC \NR
+\NC vf \NC virtual font files, used for building glyph
+ collections from other ones \NC \NR
+\NC afm \NC Adobe font metric files that are more limited
+ than \type {tfm} files (especially for math
+ fonts) \NC \NR
+\NC pfm \NC Windows specific font metric files, not used
+ by \TEX\ applications \NC \NR
+\NC pfb \NC files that contain the outline specification of
+ the glyphs fonts, also called Type 1 \NC \NR
+\NC enc \NC files with encoding vector specifications \NC \NR
+\NC map \NC files that specify how and what font files
+ are to be included \NC \NR
+\HL
+\stoptabulate
+
+On your disk (or cdrom) these files are organized in such a
+way that they can be located fast. \footnote {If you have
+installed \TETEX\ or \FPTEX\ (possibly from the \TEX live
+\CDROM) you will have many thousands of font files on your
+system.} The directory structure normally is as follows:
+
+\starttyping
+texmf / fonts / tfm / vendor / name / *.tfm
+ / afm / vendor / name / *.afm
+ / pfm / vendor / name / *.pfm
+ / vf / vendor / name / *.vf
+ / type1 / vendor / name / *.pfb
+ / pdftex / config / *.cfg
+ / config / *.map
+ / config / encoding / *.enc
+\stoptyping
+
+The \type {texmf-local} or even better \type {texmf-fonts}
+tree normally contains your own fonts, so that you don't
+have to reinstall them when you reinstall the main tree.
+The \type {pdftex} directory contains the files that
+\PDFTEX\ needs in order to make decisions about the fonts
+to include. The \type {enc} files are often part of
+distributions, as is the configuration \type {cfg} file.
+When you install new fonts, you often also have to add or
+edit \type {map} files.
+
+\CONTEXT\ comes with a \PERL\ script \type {texfont.pl}
+that you can use to install new fonts. Since its usage is
+covered by a separate manual, we limit ourselves to a short
+overview.
+
+Say that you have just bought a new font. A close look at
+the files will reveal that you got at least a bunch of \type
+{afm} and \type {pfb} files and if you're lucky \type {tfm}
+files.
+
+Installing such a font can be handled by this script. For
+this you need to know (or invent) the name of the font
+vendor, as well as the name of the font. The full set of
+command line switches is given below: \footnote {there are a
+couple of more switches described in the manual \type
+{mtexfonts}.}
+
+\starttabulate[|lT|lp|]
+\HL
+\NC \bf switch \NC \bf meaning \NC \NR
+\HL
+\NC fontroot \NC texmf font root (automatically determined) \NC \NR
+\NC vendor \NC vendor name (first level directory) \NC \NR
+\NC collection \NC font collection (second level directory)\NC \NR
+\NC encoding \NC encoding vector (default: texnansi) \NC \NR
+\NC sourcepath \NC when installing, copy from this path \NC \NR
+\NC install \NC copy files from source to font tree \NC \NR
+\NC makepath \NC when needed, create the paths \NC \NR
+\NC show \NC run tex on \type{*.tex} afterwards \NC \NR
+\HL
+\stoptabulate
+
+You seldom need to use them all. In any case it helps if you
+have a local path defined already. The next sequence does
+the trick:
+
+\starttyping
+texfont --ve=FontFun --co=FirstFont --en=texnansi --ma --in
+\stoptyping
+
+This will generate the \type {tfm} files from the \type
+{afm} files, and copy them to the right place. The Type~1
+files (\type {pfb}) will be copied too. The script also
+generates a \type {map} file. When this is done successfully,
+a \TEX\ file is generated and processed that shows the font
+maps. If this file looks right, you can start using the
+fonts. The \TEX\ file also show you how to define the fonts.
+
+This script can also do a couple of more advanced tricks.
+Let us assume that we have bought (or downloaded) a new
+font package in the files \type {demofont.afm} and \type
+{demofont.pfb} which are available on the current (probably
+scratch) directory. First we make sure that this font is
+installed (in our case we use a copy of the public Iwona
+Regular):
+
+\starttyping
+texfont --ve=test --co=test --ma --in demofont
+\stoptyping
+
+We can now say:
+
+% \loadmapfile[demofont.map] % in case we forgot to generate
+
+\startbuffer
+\loadmapfile[texnansi-test-test.map]
+\definefontsynonym[DemoFont][texnansi-demofont]
+\ruledhbox{\definedfont[DemoFont at 50pt]Interesting}
+\stopbuffer
+
+\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
+
+From this font, we can derive a slanted alternative by
+saying:
+
+\starttyping
+texfont --ve=test --co=test --ma --in --sla=.167 demofont
+\stoptyping
+
+The map file is automatically extended with the entry needed.
+
+\startbuffer
+\definefontsynonym[DemoFont-Slanted][texnansi-demofont-slanted-167]
+\ruledhbox{\definedfont[DemoFont-Slanted at 50pt]Interesting}
+\stopbuffer
+
+\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
+
+We can also create a wider version:
+
+\starttyping
+texfont --ve=test --co=test --ma --in --ext=1.50 demofont
+\stoptyping
+
+When you use the \type {--make} and \type {--install} switch,
+the directories are made, fonts installed, and entries
+appended to the map file if needed.
+
+\startbuffer
+\definefontsynonym[DemoFont-Extended][texnansi-demofont-extended-1500]
+\ruledhbox{\definedfont[DemoFont-Extended at 50pt]Interesting}
+\stopbuffer
+
+\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
+
+Instead of using pseudo caps in \TEX\ by using \type
+{\kap}, you can also create a pseudo small caps font.
+
+\starttyping
+texfont --ve=test --co=test --ma --in --cap=0.75 demofont
+\stoptyping
+
+This method is much more robust but at the cost of an extra
+font.
+
+\startbuffer
+\definefontsynonym[DemoFont-Caps][texnansi-demofont-capitalized-750]
+\ruledhbox{\definedfont[DemoFont-Caps at 50pt]Interesting}
+\stopbuffer
+
+\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
+
+\starttabulate[|lT|lp|]
+\HL
+\NC \bf switch \NC \bf meaning \NC \NR
+\HL
+\NC extend=factor \NC stretch the font to the given factor \NC \NR
+\NC narrow=factor \NC shrink the font to the given factor \NC \NR
+\NC slant=factor \NC create a slanted font \NC \NR
+\NC caps=factor \NC replace lowercase characters by small uppercase ones \NC \NR
+\NC test \NC use test/test as vendor/collection \NC \NR
+\HL
+\stoptabulate
+
+When manipulating a font this way, you need to provide a
+file name. Instead of a factor you can give the keyword
+\type {default} or a \type {*}.
+
+\starttyping
+texfont --test --auto --caps=default demofont
+\stoptyping
+
+The previous example runs create fonts with the rather
+verbose names:
+
+\starttyping
+demofont
+demofont-slanted-167
+demofont-extended-150
+demofont-capitalized-750
+\stoptyping
+
+This naming scheme makes it possible to use more instances
+without the risk of conflicts.
+
+In the distribution you will find an example batch file
+\type {type-tmf.dat} which creates metrics for some free
+fonts for the encoding specified. When you create the
+default font metrics this way, preferably \type
+{texmf-fonts}, you have a minimal font system tuned for you
+prefered encoding without the risk for name clashes. When
+you also supply \type {--install}, the font outlines will be
+copied from the main tree to the fonts tree, which sometimes
+is handy from the perspective of consistency.
+
+\section {Getting started}
+
+\todo{This section needs to be modernized}
+
+The way \TEX\ searches for files (we're talking \WEBC\ now)
+is determined by the configuration file to which the \type
+{TEXMFCNF} environment variable points (the following
+examples are from my own system):
+
+\starttyping
+set TEXMFCNF=T:/TEXMF/WEB2C
+\stoptyping
+
+When searching for files, a list of directories is used:
+
+\starttyping
+set TEXMF={$TEXMFFONTS,$TEXMFPROJECT,$TEXMFLOCAL,!!$TEXMFMAIN}
+\stoptyping
+
+Here we've added a font path, which itself is set with:
+
+\starttyping
+set TEXMFMAIN=E:/TEX/TEXMF
+set TEXMFLOCAL=E:/TEX/TEXMF-LOCAL
+set TEXMFFONTS=E:/TEX/TEXMF-FONTS
+\stoptyping
+
+Now you can generate metrics and map files. The batch file is
+searched for at the \CONTEXT\ data path in the \TEXMF\ tree
+or on the local path.
+
+\starttyping
+texfont --encoding=ec --batch type-tmf.dat
+\stoptyping
+
+If you want to play with encoding, you can also generate
+more encodings, like \type {8r} or \type {texnansi}.
+
+\starttyping
+texfont --encoding=texnansi --batch type-tmf.dat
+texfont --encoding=8r --batch type-tmf.dat
+\stoptyping
+
+After a while, there will be generated \type {tfm}, \type
+{vf}, and \type {map} files. If you let \CONTEXT\ pass
+the map file directives to \PDFTEX, you're ready now.
+Otherwise you need to add the names of the mapfiles to the
+file \type {pdftex.cfg}. You can best add them in front of
+the list, and, if you use \CONTEXT\ exclusively, you can
+best remove the other ones.
+
+As a test you can process the \TEX\ files that are generated
+in the process. These also give you an idea of how well the
+encoding vectors match your expectations.
+
+Now, the worst that can happen to you when you process your
+files, is that you get messages concerning unknown \type
+{tfm} files or reports on missing fonts when \PDFTEX\
+writes the file. In that case, make sure that you indeed
+{\em have} the right fonts (generated) and|/|or that the map
+files are loaded. As a last resort you can load all map
+files by saying:
+
+\starttyping
+\usetypescript [map] [all]
+\stoptyping
+
+and take a look at the log file and see what is reported.
+
+In due time we will provide font generation scripts for
+installation of other fonts as well as extend the
+typescript collection.
+
+\section {Remarks}
+
+It really makes sense to take a look at the font and type
+definition files (\type {font-*.tex} and \type {type-*.tex}).
+There are fallbacks defined, as well as generic definitions.
+Studying styles and manual source code may also teach you a
+few tricks.
+
+\stopcomponent