How to make this typescript work in ConTeXt?

1,123

Replace the \usebodyfont[myfont] line in your example with \setupbodyfont[myfont] to enable your typeface.

A alternative to the simplefonts module is the \definefontfamily command from the core which allows you to use fonts without the need to write a typescript.

\definefontfamily [kleymissky] [rm] [Kleymissky]
\definefontfamily [kleymissky] [ss] [Latin Modern Sans]
\definefontfamily [kleymissky] [tt] [Latin Modern Mono] [features=none]
\definefontfamily [kleymissky] [mm] [Latin Modern Math]

\setupbodyfont[kleymissky]

\starttext

This is rm.

{\ss This is ss.}

{\tt This is tt.}

\stoptext
Share:
1,123

Related videos on Youtube

ana
Author by

ana

Updated on August 01, 2022

Comments

  • ana
    ana over 1 year

    I'm trying to come to grips with typescripts in ConTeXt. Amongst all the examples and all the documentation, it just is not clear what is happening.

    I downloaded a new font for use with this example here. It's called kleymissky and the output of mtxrun --script fonts --info is here.

    My test file is as follows:

    \starttypescript[serif][kleymissky]
        \setups[font:fallback:serif]
        \definefontsynonym[Serif][name:kleymissky][features=default]
    \stoptypescript
    
    \starttypescript [myfont]
        \definetypeface[myfont][rm][serif][kleymissky][default]
        \definetypeface[myfont][ss][sans][modern][default]
        \definetypeface[myfont][tt][mono][modern][default]
    \stoptypescript
    
    \usebodyfont[myfont]
    
    \starttext
    {\tf This is tf.} 
    {\ss This is ss.} 
    {\tt This is tt.} 
    {\definedfont[name:kleymissky] This is kleymissky.}
    {\definedfont[name:modern] This is latin-modern.}
    \stoptext
    

    The intent is to use kleymissky for the main serif font, but to revert to the Latin Modern font for ss and tt. But that is not the behavior:

    output2

    For comparison, I tried the simplefonts module, which ended up doing what I wanted:

    \usemodule   [simplefonts]
    \setmainfont [kleymissky]
    
    \starttext
    {\tf This is tf.}
    {\ss This is ss.}
    {\tt This is tt.}
    {\definedfont[name:kleymissky] This is kleymissky.}
    {\definedfont[name:modern] This is latin-modern.}
    \stoptext
    

    and I get:

    output3

    So obviously I'm doing something wrong, but I cannot fathom what. Could someone help me to fix this typescript and/or help me to understand what is happening?

    • Wolfgang Schuster
      Wolfgang Schuster almost 9 years
      Use \setupbodyfont[myfont] to load the fonts from your typescript.