11

I would like to use an .otf Font for my document which I typeset in ConTeXt MKiV. Sadly I was not able to change the font. I set export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts and ran mtxrun --script fonts --reload

To query the database worked fine for the fonts I have installed.

Where it comes to a halt are the typescripts. I use (at the begin of the same file as the rest of the document)

\starttypescript [sans] [delicious] 
  \definefontsynonym [sans]           [name:delicious]
\stoptypescript


\setupbodyfont[sans,rm,10pt]

And I only get the Computer Modern Font.

Sorry if the question is pretty noob-ish, but I did try several times with different fonts and read the Documentation in the Wiki as well. But some examples I can't get to work and some state that the examples are outdated (e.g. TypeScripts). What would help me?

  • 1
    The easiest way is to use the simplefonts module: \usemodule[simplefonts] \setmainfont[Delicious] – Marco Jun 1 '12 at 14:58
  • Thanks. I'll give it a try, though I'd like to learn about the typescript way too. – JanD Jun 1 '12 at 15:36
10

As I mentioned in my comment, you can use the simplefonts module, which is an easy way to get fonts working in ConTeXt. It's as simple as this:

\usemodule   [simplefonts]
\setmainfont [Delicious]

Or you can use typescripts, which is a more flexible way. Here is a very simple typescript:

\starttypescriptcollection [delicious]
  \starttypescript [sans] [delicious] [name]
    \setups[font:fallback:sans]
    \definefontsynonym [Sans]           [name:deliciousroman] [features=default]
    \definefontsynonym [SansBold]       [Sans]                [features=default]
    \definefontsynonym [SansItalic]     [Sans]                [features=default]
    \definefontsynonym [SansBoldItalic] [Sans]                [features=default]
  \stoptypescript

  \starttypescript [delicious]
    \definetypeface [\typescriptone] [rm] [serif] [modern]    [default]
    \definetypeface [\typescriptone] [ss] [sans]  [delicious] [default]
    \definetypeface [\typescriptone] [tt] [mono]  [modern]    [default]
    \definetypeface [\typescriptone] [mm] [math]  [modern]    [default]
  \stoptypescript
\stoptypescriptcollection

Now you can use your font like this:

\setupbodyfont [delicious, sans]
\starttext  
  \input ward
\stoptext

For a more advanced typescript look at my answer to the question “Activating ligatures with typescript in ConTeXt”. Also relevant might be the answer to How do I use a particular font for a small section of text in my document?

It is also a good idea to study the typescripts that come with the ConTeXt distrubution. The files are named type-imp-<font>.mkiv. It's not that hard to adapt one of those to your needs and you have something to start with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.