# Understanding how fonts work in ConTeXt - Old Content

Jump to navigation Jump to search

Consider reading:

Most of the following material comes from the answers I got on the mailing list and/or the documentation (mfonts.pdf). Since crediting people for each and every answer would be cumbersome, I'd like to thank here all of you that helped me understand ConTeXt (especially Hans, of course).

## How to typeset in, say, Palatino

```\usetypescriptfile[type-gyr]
\usetypescript[palatino][qx]
\setupbodyfont[palatino,10pt]

\starttext
Hello world, I'm Palatino!
\stoptext
```

\usetypescriptfile loads a given file (type-gyr.tex in this case). This file usually contains definitions of typescripts. The core typescript files (such as type-tmf.tex, type-one.tex in pdTeX or type-otf.tex in LuaTeX/XeTeX, ...) are already preloaded, so you would usually need this only to load your own definitions. `\usetypescriptfile[type-gyr]` will soon become obsolete (TeX Gyre will be the default).

\usetypescript kind of "selects" (?) the specified typescript from that file. It takes up to three parametres and their rôles are still cryptic to me...

## Defining typescripts

One of the keys for defining typescripts is clever usage of the \definefontsynonym command. It takes 2 or three parameters. Example from mfonts.pdf:

```\definefontsynonym[Serif][Times-Roman]
\definefontsynonym[Times-Roman][tir][encoding=texnansi]```

The first case - with two arguments - makes `Serif` kind of an "alias" (?) for `Times-Roman`. Both names are completely independent of name of the font file. This is clever, since instead of fiddling with font file names one can say `Times-Roman` and just don't care where it resides on tbe disk. Or even better: one can say `Serif` and don't care whether the final version of the document will use Times, Palatino or Latin Modern.

The second one makes `Times-Roman` an "alias" (?) for font stored in the file called `tir` (probably with some extension?). The third argument specifies the encoding (it might be qx, for instance, or something else) and possibly another options, like `features=smallcaps` (for opentype fonts). Encoding is used by pdfTeX only - XeTeX and LuaTeX both use Unicode (Mojca - thanks for this point!). Other possibilities include `mapping` and `handling`, but don't ask me about these;).