![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Bruce Horrocks via ntg-context schrieb am 25.08.2021 um 23:15:
On 25 Aug 2021, at 13:56, Wolfgang Schuster
wrote: Bruce Horrocks via ntg-context schrieb am 25.08.2021 um 14:28:
Why does HerosBold give bold italic instead of just bold?
\definefont[TestA][name:Heros at 14pt] \definefont[TestB][name:HerosBold at 14pt] \definefont[TestC][name:HerosItalic at 14pt] \starttext \TestA {The quick brown} \TestB {fox jumps over} \TestC {the lazy dog} \stoptext I guess you try to use TeX Gyre Heros, when this is the case you use the wrong names for the font. The correct names are in the following example.
Another problem is how you use the new font commands, unlike many other user created commands \definefont creates a switch and you have to move the left braces before the command.
\definefont [TestA] [name:texgyreheros*default at 14pt] \definefont [TestB] [name:texgyreherosbold*default at 14pt] \definefont [TestC] [name:texgyreherositalic*default at 14pt]
\starttext {\TestA The quick brown} {\TestB fox jumps over} {\TestC the lazy dog} \stoptext
In my cases it is easier to use \switchtobodyfont rather than using a fixed font style, below is a modified version of your example above. While the example itself isn't very useful the method can be used to change the font for a header, typing environment etc.
\usebodyfont[heros]
\starttext \style[style={\switchtobodyfont[heros,14pt]}]{The quick brown} \style[style={\switchtobodyfont[heros,14pt]\bf}]{fox jumps over} \style[style={\switchtobodyfont[heros,14pt]\it}]{the lazy dog} \stoptext Thanks Wolfgang. I always get very confused when ConTeXt 'nearly' works and this was one of those times. Your \style example is interesting and I'll bear it in mind but at the moment I only need this for some one-off title page text rather than body text.
In this case you change the font once at the start of the title page, afterwards you can use \bf and \it to change styles. \usebodyfont[heros] \definebodyfontenvironment [14pt] \starttext \startstandardmakeup [style={\switchtobodyfont[heros,14pt]}] The quick brown {\bf fox jumps over} {\it the lazy dog} \stopstandardmakeup \stoptext Wolfgang