> On 26 Jun 2019, at 21:53, Pablo Rodriguez <oi...@gmx.es> wrote:
> On 6/25/19 10:08 PM, Taco Hoekwater wrote:
>>> Op 25 jun. 2019 om 21:42 heeft Pablo Rodriguez het volgende geschreven:
>>> BTW, I wonder why the second definition of \DesiredFont doesn’t change
>>> the font for the buffer used after it.
>> Using \switchtobodyfont instead of \setupbodyfont for all except the
>> first call should help. You may need to add a
>> \usebodyfont[mainface_corrected] as well (in the setup block). I
>> cannot actually test right now, on a mobile device...
> Many thanks for your reply, Taco.
> I’m afraid that I cannot make it work.
> I guess I must be doing something wrong.

No, it is not you. 

The problem is that \definefontfamily always expands its arguments
completely, so by the time you call the body font up, it will already
contain the actual font name instead of the macro \DefinedFont. 

(I had to test that for myself first)

Also, it seems that \definefontfamily does not like redefinitions.

(I had to test that for myself as well)

> I’d like to know which are the differences among \setupbodyfont,
> \switchtobodyfont and \usebodyfont.

Generally, you use \setupbodyfont exactly once, in the setup area. 
This sets up the fonts for the whole document, and it also sets up 
some values for the ‘global environment’ (various internals use the body 
font size, for instance).

If you do not call \setupbodyfont yourself, then ConTeXt will do an implicit


at the \starttext command, just to make sure there is a valid
body font defined.

If you want to use other body font definitions as well, you can use 

  \usebodyfont[mainface_corrected] % etc.

which temporarily switches to the specified body font set, but immediately
switches back to whatever was active before. It exists mostly for
cosmetic reasons. ;)

When you want to switch to any of the preloaded body font sets inside your
document, you normally would use \switchtobodyfont. This only affects the 
document text, not headers and footers, and does also not do the global setup.

You could use \setupbodyfont instead, but \switchtobodyfont is usually what 
you want, and it is also a bit faster.

Anyway, about your example: here is a version that does do the switching:

   \setupitaliccorrection[global, always]
           [{\em \recurselevel}]
           [{\em \characters{\recurselevel}}]
           [{\em \Characters{\recurselevel}}]
           ({\em \characters{\recurselevel}})
           ({\em \Characters{\recurselevel}})
           [{\em \recurselevel}]
           [{\em \characters{\recurselevel}}]
           [{\em \Characters{\recurselevel}}]
           ({\em \characters{\recurselevel}})
           ({\em \Characters{\recurselevel}})
   \def\DesiredFont{TeX Gyre Termes}
   \def\DesiredFont{TeX Gyre Pagella}

Best wishes,

If your question is of interest to others as well, please add an entry to the 

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net

Reply via email to