[NTG-context] set fallback in \definefont

Pablo Rodriguez oinos at gmx.es
Mon Feb 15 21:51:35 CET 2021


On 2/15/21 8:47 PM, Mohammad Hossein Bateni wrote:
> Hi,
>
> Is there a way to set the fallback for fonts when we define them not as
> a typescript but using \definefont?
>
> \definefont[MyFont][Font.otf*MyFeatures]
>
> Is there a default fallback one can specify?
> Is simplefonts module deprecated or discouraged now?

Hi Mohammad,

the simplefonts module has been deprecated, since it has been
implemented in the ConTeXt core (see below).

\definefontfallback might be the command you are looking for.

> When we define a font via typescript commands, we can specify rm, ss,
> tt, mm, hw and cg shapes for it.  Can we add arbitrary styles? 
> For example, I would use this for quotations, headings, etc.  Currently,
> I either have to spare ss or use \definefont for such scenarios.

The new commands are \definefallbackfamily and \definefontfamily.

A sample document, in case it might help (GFS Heraklit at
https://greekfontsociety-gfs.gr/_assets/fonts/GFS_Heraklit.zip):

  \definefallbackfamily
    [mainface]
    [rm]
    [GFS Heraklit]
    [preset=range:greek,
     force=yes]

  \definefontfamily
    [mainface]
    [rm]
    [TeX Gyre Pagella]

  \setupbodyfont
    [mainface]

  \starttext
    \agr\input aristotle-grc

    \de\input aesop-de
  \stoptext

Sorry, but unless you provide a minimal sample, it isn’t easy to guess
what you might have in mind.

I’m afraid that I’m not sure whether the following sample contains your
“arbitrary styles”.

  \setupinteractionscreen[option=max]

  \definefontfamily
    [mainface]
    [rm]
    [TeX Gyre Pagella]
    [it={TeX Gyre Cursor-Italic},
     bf={TeX Gyre Adventor-Bold},
     bi={TeX Gyre Termes-BoldItalic}]

  \setupbodyfontenvironment
    [default]
    [em=italic]

  \setupbodyfont[mainface]

  \starttext
  \startTEXpage[offset=1em]
  Roman font {\em & italic}

  {\bf Bold font \em & bold italic}
  \stopTEXpage
  \stoptext

Feel free to explain what your needs are.

I hope it helps,

Pablo
--
http://www.ousia.tk


More information about the ntg-context mailing list