Command/definetypeface

From Wiki
Jump to navigation Jump to search

\definetypeface

Syntax (autogenerated)

\definetypeface[...][...][...][...][...][...=...,...]
[...]name
[...]rm ss tt mm hw cg
[...]serif sans mono math handwriting calligraphy
[...]name
[...]default dtp
rscaleauto number
featuresname
fallbacksname
goodiesname
designsizeauto default
directionboth


Description

\definetypeface sets up a typeface for use within a typescript. This typeface links a style (rm, ss, etc.) to an actual font family (or font set).

The first argument specifies the typescript of which the newly defined typeface will be a part.

The second argument tells which style to define a typeface for.

The third and fourth arguments to \definetypeface are pointers to already declared font sets; these are defined elsewhere. Table 5.8 gives the full list of predefined typescripts (the first argument of \starttypescript) and font sets that are attached to the styles (the third and fourth argument of each \definetypeface). The names in the third argument (like serif and sans) do not have the same meaning as the names used in \setupbodyfont. Inside \setupbodyfont, they were keywords that were in- ternally remapped to one of the two-letter internal styles. Inside \definetypeface, they are nothing more than convenience names that are attached to a group of fonts by the person that wrote the font definition. They only reflect a grouping that the person believed that could be a single font style. Oftentimes, these names are identical to the official style keywords, just as the typescript and typeface names are often the same, but there can be (and sometimes are) different names altogether.

How to define your own font sets is explained in the reference manual, but there are quite a few predefined font sets that come with ConTEXt; these are all listed in the four tables 5.9, 5.10, 5.11, and 5.12. For everything to work properly in MkII, the predefined font sets also have to have an encoding attached, you can look those up in the relevant tables as well.

The fifth argument to \definetypeface specifies specific font size setups (if any), these will be covered in the reference manual. Almost always, specifying default will suffice.

The optional sixth argument is used for tweaking font settings like the specification of font features or adjusting parameters. In this case, the two modern font sets are loaded with a small magnification, this evens out the visual heights of the font styles.

Example

\starttypescript [palatino]
 \definetypeface[palatino] [rm] [serif][palatino] [default]
 \definetypeface[palatino] [ss] [sans] [modern] [default] [rscale=1.075]
 \definetypeface[palatino] [tt] [mono] [modern] [default] [rscale=1.075]
 \definetypeface[palatino] [mm] [math] [palatino] [default]
\stoptypescript

This defines a typescript named palatino. When this typescript is executed via \usetypescript, it will define four typefaces that are (by coincidence) also called palatino; one of each of the four basic styles rm, ss, tt, and mm. These typefaces are then usable as arguments to \setupbodyfont or \switchtobodyfont

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: