Is there a canonical way to access font weights other than regular and bold in ConTeXt? This does not work:

\definefontfamily [myfamily] [serif][Calluna]
\definefontfamily [myfamily] [sans] [Calluna Sans Light]

\setupbodyfont [myfamily]

1. Avec Serif\\
{\ss 2. Sans Serif}
\it 3. Avec Serif\\
\ss\bi 4. Sans Serif

Line 1 and 3 come out OK, serif regular and serif regular italic; the lines containing \ss come out as serif regular. If I leave out the Light in the family definition everything works as expected, i.e. line 2 as sans serif regular and line 4 as sans serif bold italic.

I do have the fonts, Gnome Font Manager knows them and mtxrun --script fonts --list --all --pattern=Calluna* too:

calluna                     callunablack                /home/thomas/.local/share/fonts/exljbris - Calluna-Black.otf
callunablack                callunablack                /home/thomas/.local/share/fonts/exljbris - Calluna-Black.otf
callunabold                 callunabold                 /home/thomas/.local/share/fonts/exljbris - Calluna-Bold.otf
callunaboldit               callunaboldit               /home/thomas/.local/share/fonts/exljbris - Calluna-BoldIt.otf
callunabolditalic           callunaboldit               /home/thomas/.local/share/fonts/exljbris - Calluna-BoldIt.otf
callunait                   callunait                   /home/thomas/.local/share/fonts/exljbris - Calluna-It.otf
callunaitalic               callunait                   /home/thomas/.local/share/fonts/exljbris - Calluna-It.otf
callunalight                callunalight                /home/thomas/.local/share/fonts/exljbris - Calluna-Light.otf
callunanormal               callunait                   /home/thomas/.local/share/fonts/exljbris - Calluna-It.otf
callunaregular              callunaregular              /home/thomas/.local/share/fonts/exljbris - Calluna-Regular.otf
callunasans                 callunasansblack            /home/thomas/.local/share/fonts/CallunaSansBlack.otf
callunasansblack            callunasansblack            /home/thomas/.local/share/fonts/CallunaSansBlack.otf
callunasansblackitalic      callunasansblackitalic      /home/thomas/.local/share/fonts/CallunaSansBlackItalic.otf
callunasansbold             callunasansbold             /home/thomas/.local/share/fonts/CallunaSansBold.otf
callunasansbolditalic       callunasansbolditalic       /home/thomas/.local/share/fonts/CallunaSansBoldItalic.otf
callunasansdemibold         callunasanssemibold         /home/thomas/.local/share/fonts/CallunaSansSemiBold.otf
callunasansitalic           callunasansitalic           /home/thomas/.local/share/fonts/exljbris - CallunaSans-Italic.otf
callunasanslight            callunasanslight            /home/thomas/.local/share/fonts/CallunaSansLight.otf
callunasanslightitalic      callunasanslightitalic      /home/thomas/.local/share/fonts/CallunaSansLightItalic.otf
callunasansnormal           callunasansitalic           /home/thomas/.local/share/fonts/exljbris - CallunaSans-Italic.otf
callunasansregular          callunasansregular          /home/thomas/.local/share/fonts/exljbris - CallunaSans-Regular.otf
callunasanssemibold         callunasanssemibold         /home/thomas/.local/share/fonts/CallunaSansSemiBold.otf
callunasanssemibolditalic   callunasanssemibolditalic   /home/thomas/.local/share/fonts/CallunaSansSemiBoldItalic.otf
callunasemibold             callunasemibold             /home/thomas/.local/share/fonts/exljbris - Calluna-Semibold.otf
callunasemiboldit           callunasemiboldit           /home/thomas/.local/share/fonts/exljbris - Calluna-SemiboldIt.otf

Saying callunasanslight instead of Calluna Sans Light doesn't work either. What I'm trying to do is using Sans Light and Sans Semibold instead of Sans and Sans Bold. But it would also be nice to have font switches for light, semibold and heavy in addition to \bf and \tf.

BTW: The bigger question is really: Where does one find documentation on such stuff in ConTeXt??? ConTeXt is such a difficult word to google!

Edit: I found one way to work this, at least partially:

\definefontfamily [myfamily][sans] [Calluna Sans]
                  [tf=Calluna Sans Light,
                   it=Calluna Sans Light Italic,
                   bf=Calluna Sans SemiBold,
                   bi=Calluna Sans SemiBold Italic,
                   sc=Calluna Sans Light]

It is not in the definition or the description of \definefontfamily on contextgarden. There is no description there at all, just a number of examples.

Anyway, I'm still missing (a) the semibold smallcaps and (b) a way to make all the weights accessible "at the same time".

  • 2
    Make the edit an answer then and accept it. BTW: googling "context mkiv" helps ;) – DG' Apr 11 '16 at 12:26
  • Sorry, it's only a partial solution. Edited again to make things clearer. – Blackface Apr 11 '16 at 14:21
  • Yes, "context mkiv" indeed helps with the search. – Blackface Apr 11 '16 at 15:57
  • 1
    Again, I would suggest that you ask this on the context mailing list. There are only a few context users here – Aditya Apr 14 '16 at 17:23
  • Thank you, yes I will, just waiting for the confirmation of list membership. – Blackface Apr 15 '16 at 6:37

To access more alternatives with a single typeface you have to create first additional alternatives with the \definefontalternative command. For my example I add new definitions for a light and a medium style, for the name of the alternative itself you’re limited to two letter for each and you should ensure no important commands are overwritten, e.g. below I overwrite the language switch for lithuanian which can be ignored because you can still use \language[lt] in a document.

\definefontalternative[lt] % light
\definefontalternative[li] % lightitalic
\definefontalternative[md] % medium
\definefontalternative[mi] % mediumitalic

Now you can add entries for the light and medium styles in your typescript and map synonyms to the font files, for the names of the synonyms you should stick close the the default names, e.g. I used SerifLight for the light style if the font.

\starttypescript [serif] [antykwa-torunska-extended]
  \definefontsynonym [SerifLight]        [file:antykwatorunskalightregular] [features=default]
  \definefontsynonym [SerifLightItalic]  [file:antykwatorunskalightitalic]  [features=default]
  \definefontsynonym [Serif]             [file:antykwatorunskaRegular]      [features=default]
  \definefontsynonym [SerifItalic]       [file:antykwatorunskaitalic]       [features=default]
  \definefontsynonym [SerifMedium]       [file:antykwatorunskamedregular]    [features=default]
  \definefontsynonym [SerifMediumItalic] [file:antykwatorunskameditalic]   [features=default]
  \definefontsynonym [SerifBold]         [file:antykwatorunskabold]         [features=default]
  \definefontsynonym [SerifBoldItalic]   [file:antykwatorunskabolditalic]   [features=default]
  \definefontsynonym [SerifCaps]         [file:antykwatorunskaregular]      [features=smallcaps]

Now comes the important part where I assign the files for the light and medium styles to the additional alternatives which is done with the \definebodyfont command.

\starttypescript [serif] [antykwa-torunska-extended]
  \definebodyfont [default] [rm]
     [lt=SerifLight sa 1,
      li=SerifLightItalic sa 1,
      tf=Serif sa 1,
      it=SerifItalic sa 1,
      md=SerifMedium sa 1,
      mi=SerifMediumItalic sa 1,
      bf=SerifBold sa 1,
      bi=SerifBoldItalic sa 1,
      sc=SerifCaps sa 1]

After this is done you I can now create a new typeface which supports alternatives than the one provided by default (\tf, \it etc.).




\NC \tex{lt} \NC \lt Light        \NC\NR
\NC \tex{li} \NC \li LightItalic  \NC\NR
\NC \tex{tf} \NC \tf Regular      \NC\NR
\NC \tex{it} \NC \it Italic       \NC\NR
\NC \tex{md} \NC \md Medium       \NC\NR
\NC \tex{mi} \NC \mi MediumItalic \NC\NR
\NC \tex{bf} \NC \bf Bold         \NC\NR
\NC \tex{bi} \NC \bi BoldItalic   \NC\NR
\NC \tex{sc} \NC \sc SmallCaps    \NC\NR


Example with new font alternatives for ConTeXt

  • Can this be made to work with the \em command, so that {\lt light text can be {\em emphasised} in the usual way}? – TEV Sep 27 '17 at 10:03
  • 1
    @TEV The \em command works only with the default alternatives and there is no way to add the additional ones. – Wolfgang Schuster Jul 3 '18 at 15:23

I am relatively new to ConTeXt but I think the canonical solution to any font loading problem is writing a typescript. To access semibold small caps you have to do \setff{smallcaps}\bf. This is due to the fact that \sc and \bf are not additive (just like in Plain TeX). Once you switch to small caps using \setff you can access all the different styles using the mnemonic font switches.

I don't have the proprietary Calluna fonts, so I'm using TeX Gyre Termes and TeX Gyre Heros. Just substitute the files and it should work.

\starttypescriptcollection [calluna]

  \starttypescript [serif] [calluna]
    \definefontsynonym [Serif]           [file:texgyretermes-regular.otf]    [features=default]
    \definefontsynonym [SerifItalic]     [file:texgyretermes-italic.otf]     [features=default]
    \definefontsynonym [SerifBold]       [file:texgyretermes-bold.otf]       [features=default]
    \definefontsynonym [SerifBoldItalic] [file:texgyretermes-bolditalic.otf] [features=default]
    \definefontsynonym [SerifCaps]       [file:texgyretermes-regular.otf]    [features=smallcaps]

  \starttypescript [sans] [calluna]
    \definefontsynonym [Sans]           [file:texgyreheros-regular.otf]    [features=default]
    \definefontsynonym [SansItalic]     [file:texgyreheros-italic.otf]     [features=default]
    \definefontsynonym [SansBold]       [file:texgyreheros-bold.otf]       [features=default]
    \definefontsynonym [SansBoldItalic] [file:texgyreheros-bolditalic.otf] [features=default]
    \definefontsynonym [SansCaps]       [file:texgyreheros-regular.otf]    [features=smallcaps]

  \starttypescript [calluna]
    \definetypeface [calluna] [rm] [serif] [calluna] [default] [features=default]
    \definetypeface [calluna] [ss] [sans]  [calluna] [default] [features=default]



  \tf Serif
  \it SerifItalic
  \bf SerifBold
  \bi SerifBoldItalic

  \tf serifcaps
  \it serifitaliccaps
  \bf serifboldcaps
  \bi serifbolditaliccaps

  \ss Sans
  \it SansItalic
  \bf SansBold
  \bi SansBoldItalic

  \ss SansCaps
  \it SansItalicCaps
  \bf SansBoldCaps
  \bi SansBoldItalicCaps

enter image description here

  • Your synonyms for SansItalicCaps etc. are useless because they aren’t mapped to a alternative switch like \sc. To get these fonts working you have to create first a new switch with \definefontalternative[...] and assign then a synonym to the switch with \definebodyfont. – Wolfgang Schuster Aug 8 '16 at 0:09
  • 1
    @Metafox Indeed, removing them doesn't affect the output. But then, I wonder why the TeX Gyre typescript defines all those. Can you maybe point out an example for \definefontalternative? I found the standard ones in the ConTeXt source, but couldn't infer from these how to define my own ones. – Henri Menke Aug 8 '16 at 17:16
  • The TeX Gyre typescript add have all Caps synonyms because you can define a smallcaps only typeface (e.g. \definetypeface[...][rm][serif][pagella-caps][default]). – Wolfgang Schuster Aug 11 '16 at 10:25

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.