Re: [NTG-context] set fallback in \definefont

2021-02-15 Thread Mohammad Hossein Bateni
Thanks, Wolfgang.  This works pretty well.

On Mon, Feb 15, 2021 at 4:31 PM Wolfgang Schuster <
wolfgang.schuster.li...@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
>
> ___
>
___
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
___


Re: [NTG-context] set fallback in \definefont

2021-02-15 Thread Mohammad Hossein Bateni
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  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
>
> ___
>
___
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
___


Re: [NTG-context] set fallback in \definefont

2021-02-15 Thread Wolfgang Schuster



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
___


Re: [NTG-context] set fallback in \definefont

2021-02-15 Thread Pablo Rodriguez
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
___


[NTG-context] set fallback in \definefont

2021-02-15 Thread Mohammad Hossein Bateni
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
___
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
___


Re: [NTG-context] verify if you are already postponing notes

2021-02-15 Thread Hans Hagen

On 2/15/2021 7:14 PM, mf wrote:

Dear list,
I'm typesetting XHTML and there is a couple of cases (tables and math), 
where I use \postponenotes ... \flushnotes in both their XML setups.


The problem arises when I have math inside the cell of a table, so I get 
those commands nested:


\postponenotes %  element

\postponenotes %  element inside a cell

\flushnotes %  closing math

\flushnotes %  closing table

With CSS selectors or XML machinery I can find those corner cases, but 
something like this would be better because more general:


\doifnotpostponingnotes{\postponenotes}

\dofipostponingnotes{\flushnotes}

Is there a way to define those \doif... macros?

mkiv:

\ifconditional\postponingnotes
\else
\fi

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___


[NTG-context] verify if you are already postponing notes

2021-02-15 Thread mf

Dear list,
I'm typesetting XHTML and there is a couple of cases (tables and math), 
where I use \postponenotes ... \flushnotes in both their XML setups.


The problem arises when I have math inside the cell of a table, so I get 
those commands nested:


\postponenotes %  element

\postponenotes %  element inside a cell

\flushnotes %  closing math

\flushnotes %  closing table

With CSS selectors or XML machinery I can find those corner cases, but 
something like this would be better because more general:


\doifnotpostponingnotes{\postponenotes}

\dofipostponingnotes{\flushnotes}

Is there a way to define those \doif... macros?

Massi
___
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
___


Re: [NTG-context] LMTX problem with XML

2021-02-15 Thread Pablo Rodriguez
On 2/14/21 10:32 PM, Hans Hagen wrote:
> On 2/14/2021 9:24 PM, Pablo Rodriguez wrote:
>
>> But I‘m afraid it will take some time before I can provide a minimal
>> sample showing the issue.
>
> We have plenty of time in these lock down days.

Many thanks for your reply, Hans.

Might I suggest a couple of implementations in ConTeXt for these
lockdown days?

Parallel streams (both in pages and columns) have been already mentioned
here by some other users.

BTW, a nice version of three streams in two facing pages can be seen at
https://archive.org/details/aristo-teles-poetica/page/n54/mode/1up.

The other suggestion would be page registers for footnotes (such as in
http://www.faenumpublishing.com/uploads/2/3/9/8/23987979/hippocrates_on_airs_waters_and_places_-_hayes_and_nimis_june_2013.pdf#page=126).

>> Many thanks again for your excellent work with ConTeXt,
> Maybe some bad tuc file? Sometimes wiping it helps.

I overlooked that XML output was different from a newer version of
pandoc (which I use in Windows).

The new version included the same class for parent and child element
(parent  and child ). Of course, this lead to crash, since my
lpath selection took for granted that only the parent  had that class.

In my case, copying everything to a new "testing" file (or bunch of
files) and start removing lines is the way to discover what is wrong in
the code.

Many thanks for your help,

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
___


Re: [NTG-context] tikzpicture in margin

2021-02-15 Thread Hans Hagen

On 2/14/2021 10:43 PM, Aditya Mahajan wrote:

On Sun, 14 Feb 2021, Jigé wrote:


Hi all.

I'm trying to place a TikZ picture in the margin.
Here is a small example:

\usemodule[tikz]
\setuplayout[backspace=4cm, topspace=2cm, height=middle]
\starttext
\input{lorem}
\margintext{I have discovered a truly
             marvelous proof ...  but
             this margin is too narrow
             to contain it.}
\input{lorem}
\inmargin{\externalfigure[cow] [width=\marginwidth]}
% The above works.
% The following does not:
\input{lorem}
\inmargin{
\starttikzpicture
   \draw[gray] (-2,0) grid (2,2) ;
   \draw plot [domain=-2:2, samples=50, smooth] (\x,{\x * \x});
\stoptikzpicture
}
\stoptext

-> Undefined control sequence


Most likely because the argument of \inmargin is scanned upfront and at that 
time \draw etc are undefined. One option is:

\startbuffer[picture]
\starttikzpicture
...
\stoptikzpicture
\stopbuffer

\inmargin{\getbuffer[picture]}

Another option (but better to do that in tikz module) is:

\let\draw\relax
\let\x\relax

\inmargin{\starttikzpicture ... \stoptikzpicture}


Actually the command \startmarginblock ... \stop... described in the ConText 
reference works with a TikZ picture.


Because the \start ... \stop blocks don't scan the argument.

Here's one for you to ponder:

we have this:

 % \doifelsenothing{#content}\donefalse\donetrue

we could use the slower (maybe even side effects)

 % \doifelsetext{#content}\donetrue\donefalse

but go modern instead:

   \ifparameter#content\donefalse\or\donetrue\else\donefalse\fi

i'll add that last one to lmtx

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
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
___