ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* set fallback in \definefont
@ 2021-02-15 19:47 Mohammad Hossein Bateni
  2021-02-15 20:51 ` Pablo Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Mohammad Hossein Bateni @ 2021-02-15 19:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 542 bytes --]

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?

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.

Thanks,
--MHB

[-- Attachment #1.2: Type: text/html, Size: 710 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set fallback in \definefont
  2021-02-15 19:47 set fallback in \definefont Mohammad Hossein Bateni
@ 2021-02-15 20:51 ` Pablo Rodriguez
  2021-02-15 21:30   ` Wolfgang Schuster
  2021-02-15 21:31   ` Mohammad Hossein Bateni
  0 siblings, 2 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2021-02-15 20:51 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set fallback in \definefont
  2021-02-15 20:51 ` Pablo Rodriguez
@ 2021-02-15 21:30   ` Wolfgang Schuster
  2021-02-15 21:55     ` Mohammad Hossein Bateni
  2021-02-15 21:31   ` Mohammad Hossein Bateni
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2021-02-15 21:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pablo Rodriguez



Pablo Rodriguez schrieb am 15.02.2021 um 21:51:
> 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.

You need also \definefontsynonym but it's easier to create a new 
typeface (fontfamily) and load it with \switchtobodyfont.

\definefontfallback
   [AnotherFontFallback]
   [file:texgyreherosregular*default]
   [lowercasenormal]
   [force=yes]

\definefontsynonym
   [AnotherFontMain]
   [file:texgyrepagellaregular]
   [fallbacks=AnotherFontFallback]

\definefont [AnotherFont] [AnotherFontMain*default]

\starttext

\dorecurse{26}{\convertnumber{A}{\recurselevel}\space}\par
\dorecurse{26}{\convertnumber{a}{\recurselevel}\space}

\AnotherFont

\dorecurse{26}{\convertnumber{A}{\recurselevel}\space}\par
\dorecurse{26}{\convertnumber{a}{\recurselevel}\space}

\stoptext

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set fallback in \definefont
  2021-02-15 20:51 ` Pablo Rodriguez
  2021-02-15 21:30   ` Wolfgang Schuster
@ 2021-02-15 21:31   ` Mohammad Hossein Bateni
  2021-02-16 18:34     ` Wolfgang Schuster
  1 sibling, 1 reply; 6+ messages in thread
From: Mohammad Hossein Bateni @ 2021-02-15 21:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3566 bytes --]

Thanks for the quick response, Pablo.  I already use typescripts
(\definetypeface, \definefontsynonym and \definefontfallback):
https://github.com/bateni/dabeer/tree/master/texmf-local/tex/context/fonts/mkiv

By arbitrary style, I meant something like:

\definefontfamily[myface][CUSTOM][TeX Gyre Pagella]]

https://wiki.contextgarden.net/Font_Switching says fontstyle is rm, ss, tt,
mm, hw, cg, ...
Because the the three dots at the end, I thought it would be possible to
define new fontstyles.  But I get an error if I do so.

So I usually use \definefont to set up one-off fonts for specific use-cases
such as special headings or an artwork, etc.  I was wondering if I can
easily apply fontfallbacks for those.

On Mon, Feb 15, 2021 at 3:52 PM Pablo Rodriguez <oinos@gmx.es> wrote:

> 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
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 5041 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set fallback in \definefont
  2021-02-15 21:30   ` Wolfgang Schuster
@ 2021-02-15 21:55     ` Mohammad Hossein Bateni
  0 siblings, 0 replies; 6+ messages in thread
From: Mohammad Hossein Bateni @ 2021-02-15 21:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pablo Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 2004 bytes --]

Thanks, Wolfgang.  This works pretty well.

On Mon, Feb 15, 2021 at 4:31 PM Wolfgang Schuster <
wolfgang.schuster.lists@gmail.com> wrote:

>
>
> Pablo Rodriguez schrieb am 15.02.2021 um 21:51:
> > 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.
>
> You need also \definefontsynonym but it's easier to create a new
> typeface (fontfamily) and load it with \switchtobodyfont.
>
> \definefontfallback
>    [AnotherFontFallback]
>    [file:texgyreherosregular*default]
>    [lowercasenormal]
>    [force=yes]
>
> \definefontsynonym
>    [AnotherFontMain]
>    [file:texgyrepagellaregular]
>    [fallbacks=AnotherFontFallback]
>
> \definefont [AnotherFont] [AnotherFontMain*default]
>
> \starttext
>
> \dorecurse{26}{\convertnumber{A}{\recurselevel}\space}\par
> \dorecurse{26}{\convertnumber{a}{\recurselevel}\space}
>
> \AnotherFont
>
> \dorecurse{26}{\convertnumber{A}{\recurselevel}\space}\par
> \dorecurse{26}{\convertnumber{a}{\recurselevel}\space}
>
> \stoptext
>
> Wolfgang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3044 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set fallback in \definefont
  2021-02-15 21:31   ` Mohammad Hossein Bateni
@ 2021-02-16 18:34     ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2021-02-16 18:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mohammad Hossein Bateni schrieb am 15.02.2021 um 22:31:
> Thanks for the quick response, Pablo.  I already use typescripts 
> (\definetypeface, \definefontsynonym and \definefontfallback): 
> https://github.com/bateni/dabeer/tree/master/texmf-local/tex/context/fonts/mkiv
>
> By arbitrary style, I meant something like:
>
> \definefontfamily[myface][CUSTOM][TeX Gyre Pagella]]
>
> https://wiki.contextgarden.net/Font_Switching says fontstyle is rm, 
> ss, tt, mm, hw, cg, ...
> Because the the three dots at the end, I thought it would be possible 
> to define new fontstyles.  But I get an error if I do so.

You can add additional styles but this requires more than a single line 
of code.

\definefontfamily itself is limited to the default styles because the 
command
creates a typescript behind the scenes.

Wolfgang

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-16 18:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 19:47 set fallback in \definefont Mohammad Hossein Bateni
2021-02-15 20:51 ` Pablo Rodriguez
2021-02-15 21:30   ` Wolfgang Schuster
2021-02-15 21:55     ` Mohammad Hossein Bateni
2021-02-15 21:31   ` Mohammad Hossein Bateni
2021-02-16 18:34     ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).