Re: [NTG-context] metafun 2

2019-08-17 Thread Hans Hagen

On 8/17/2019 3:27 AM, Alan Braslau wrote:

We have eofill in MP (in pdf/ps in fact) and that likely will do what you need.

You forgot the MWD (Minimal Working Demo):

\starttext

\startMPpage
path p ; p := fullcircle scaled 1cm ;
path q ; q := fullcircle scaled .5cm ;

nofill p ;
eofill q ;
\stopMPpage

\stoptext

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


Re: [NTG-context] metafun 2

2019-08-16 Thread Alan Braslau
We have eofill in MP (in pdf/ps in fact) and that likely will do what you need.

Alan


On Sat, 17 Aug 2019 00:31:38 +0100
Adam Reviczky  wrote:

> Hi Hans,
> 
> One MetaPost feature that I was looking forward to is the ability to create
> a fill between two shapes.
> Something like a difference function of two path's.
> 
> For logos I use the workaround with creating a path alongside the excluded
> areas but it is always cumbersome.
> 
> I have briefly mentioned it back here:
> https://mailman.ntg.nl/pipermail/ntg-context/2011/056910.html
> 
> Just for illustration purposes, if I wanted to fill the area in between two
> circles:
> 
> *path p ;
> **p := fullcircle scaled 1cm ;
> **path q ;
> **q := fullcircle scaled .5cm ;
> *
> 
> Instead of creating a new path along both circles with:
> 
> 
> *r := p -- reverse q -- cycle ;*
> 
> It would be nice to have something like:
> 
> *fill p excluding q ;*
> 
> or something like that.
> 
> I mainly have use-cases for differences in shapes, but filling the
> intersection of two shapes would be the same idea.
> 
> Thanks,
> Adam
> 
> 
> On Wed, Aug 14, 2019 at 10:57 AM Hans Hagen  wrote:
> 
> > Hi,
> >
> > In the process of providing an additional (more abstract) interface to
> > some of the old and also new MetaFun code we wonder what kind of
> > features users would like to see.
> >
> > http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> >
> > As a teaser I uploaded a MyWay document that shows some of what is
> > coming. All is experimental but it shows the direction. We're talking
> > ConTeXt LMTX here. For instance,
> >
> >  draw lmt_outline [
> >  content   = "hello",
> >  kind  = "reverse",
> >  fillcolor = "darkred",
> >  drawcolor = "darkblue",
> >  rulethickness = 1/2,
> >  ] ysized h shifted (3.75h,-1.25h) ;
> >
> > Wraps all the outline drawing in one macro with a set of options (there
> > will be xml interface definitions for that). Or take:
> >
> >  draw lmt_followtext [
> >  content = "How well does it work {\bf 1}! ",
> >  path= (fullcircle scaled 4cm),
> >  trace   = true,
> >  spread  = true,
> >  ] ysized 5cm ;
> >
> > which is an easier interface to text along a curve. Arrows can be drawn
> > with
> >
> >  draw lmt_arrow [
> >  kind= "draw",
> >  location= "middle",
> >  alternative = "curved",
> >  path= fullcircle
> >  scaled  3cm
> >  shifted (3.5cm,0cm),
> >  ] withcolor "darkblue" ;
> >
> > but of course the low level interface with its many variables for
> > tweaking stays around. Other examples are shown in the mentioned document.
> >
> > So the question is: What do you miss in metapost support? Of course it
> > should fit within the concept, so 'artistic freehand drawings' is not
> > something that is likely to get interfaced. We are particularly
> > interested in educational applications, if only because ConTeXt started
> > out that way.
> >
> > 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
> >
> > ___
> >  

___
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] metafun 2

2019-08-16 Thread Adam Reviczky
Hi Hans,

One MetaPost feature that I was looking forward to is the ability to create
a fill between two shapes.
Something like a difference function of two path's.

For logos I use the workaround with creating a path alongside the excluded
areas but it is always cumbersome.

I have briefly mentioned it back here:
https://mailman.ntg.nl/pipermail/ntg-context/2011/056910.html

Just for illustration purposes, if I wanted to fill the area in between two
circles:

*path p ;
**p := fullcircle scaled 1cm ;
**path q ;
**q := fullcircle scaled .5cm ;
*

Instead of creating a new path along both circles with:


*r := p -- reverse q -- cycle ;*

It would be nice to have something like:

*fill p excluding q ;*

or something like that.

I mainly have use-cases for differences in shapes, but filling the
intersection of two shapes would be the same idea.

Thanks,
Adam


On Wed, Aug 14, 2019 at 10:57 AM Hans Hagen  wrote:

> Hi,
>
> In the process of providing an additional (more abstract) interface to
> some of the old and also new MetaFun code we wonder what kind of
> features users would like to see.
>
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
>
> As a teaser I uploaded a MyWay document that shows some of what is
> coming. All is experimental but it shows the direction. We're talking
> ConTeXt LMTX here. For instance,
>
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
>
> Wraps all the outline drawing in one macro with a set of options (there
> will be xml interface definitions for that). Or take:
>
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
>
> which is an easier interface to text along a curve. Arrows can be drawn
> with
>
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
>
> but of course the low level interface with its many variables for
> tweaking stays around. Other examples are shown in the mentioned document.
>
> So the question is: What do you miss in metapost support? Of course it
> should fit within the concept, so 'artistic freehand drawings' is not
> something that is likely to get interfaced. We are particularly
> interested in educational applications, if only because ConTeXt started
> out that way.
>
> 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
>
> ___
>
___
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] metafun 2

2019-08-14 Thread Arthur Reutenauer
On Wed, Aug 14, 2019 at 10:18:19PM +1200, Henri Menke wrote:
> I just wanted to ask, will LMTX and MetaFun remain valid implementations
> of TeX and MetaPost or do we have to expect incompatibilities?

  If you mean “will luametatex pass the trip test”, the answer is
probably no: LuaTeX already diverged from Knuth’s TeX in small ways, for
example by allowing the first word of a paragraph to be hyphenated.

Best,

Arthur
___
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] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:58 PM, Mikael P. Sundqvist wrote:

1) 3d support. This is of course a very big request, but it would also 
be useful for many people.


yes ... Alan and I are thinking of some (not that we came far yet)

2) About graphing, it would be nice to be able to do contour polots and 
density plots. I know I asked for contour plots some time ago, and there 
were some examples, but I don't think there was ever some built in 
support for it. Maybe that can be done "easy" with help of lua? I guess 
there exist good algorithms.


spec needed ... as 'code' can be any function it's mostly a matter of 
what to pipe back to mp


3) (small) The possibility to have arrows in coordinate axes. I have not 
had the possibility to test the new features today, and maybe this is 
already built in (drawarrow?), but I mention it since I did not see it 
in the pdf.


no, but that is rather trivial to add


Again, it is very nice that you work on extending MetaPost/MetaFun further!!

wel, mp is ... fun (and these extension are somewhat challenging)

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
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:58 PM, Otared Kavian wrote:



On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:

[…]
This looks like a typical .. vs -- issue. I think there is a way to change how 
the points are connected, but I'll have to look at the code again.

Aditya



Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)


shape = "line"


Thanks for your attention,
Best regards: OK
___
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
___




--

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


Re: [NTG-context] metafun 2

2019-08-14 Thread Wolfgang Schuster

Otared Kavian schrieb am 14.08.2019 um 16:58:

On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:

[…]
This looks like a typical .. vs -- issue. I think there is a way to change how 
the points are connected, but I'll have to look at the code again.

Aditya

Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)

draw lmt_function [ shape = "line", ... ] ;

The argument for shape doesn't matter because only 'shape = "contour"' 
is checked to use .. as connector.


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] metafun 2

2019-08-14 Thread Mikael P. Sundqvist
On Wed, Aug 14, 2019 at 11:55 AM Hans Hagen  wrote:

> Hi,
>
> In the process of providing an additional (more abstract) interface to
> some of the old and also new MetaFun code we wonder what kind of
> features users would like to see.
>
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
>
> As a teaser I uploaded a MyWay document that shows some of what is
> coming. All is experimental but it shows the direction. We're talking
> ConTeXt LMTX here. For instance,
>
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
>
> Wraps all the outline drawing in one macro with a set of options (there
> will be xml interface definitions for that). Or take:
>
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
>
> which is an easier interface to text along a curve. Arrows can be drawn
> with
>
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
>
> but of course the low level interface with its many variables for
> tweaking stays around. Other examples are shown in the mentioned document.
>
> So the question is: What do you miss in metapost support? Of course it
> should fit within the concept, so 'artistic freehand drawings' is not
> something that is likely to get interfaced. We are particularly
> interested in educational applications, if only because ConTeXt started
> out that way.
>
> 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
>
> ___
>

Hi,

this looks very promising!!

Since you ask for feature requests:

1) 3d support. This is of course a very big request, but it would also be
useful for many people.
2) About graphing, it would be nice to be able to do contour polots and
density plots. I know I asked for contour plots some time ago, and there
were some examples, but I don't think there was ever some built in support
for it. Maybe that can be done "easy" with help of lua? I guess there exist
good algorithms.
3) (small) The possibility to have arrows in coordinate axes. I have not
had the possibility to test the new features today, and maybe this is
already built in (drawarrow?), but I mention it since I did not see it in
the pdf.

Again, it is very nice that you work on extending MetaPost/MetaFun further!!

/Mikael
___
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] metafun 2

2019-08-14 Thread Otared Kavian

> On 14 Aug 2019, at 16:53, Aditya Mahajan  wrote:
> 
> […]
> This looks like a typical .. vs -- issue. I think there is a way to change 
> how the points are connected, but I'll have to look at the code again.
> 
> Aditya


Indeed, this seems the right explanation.
@ Hans: would it be possible to change the connecting mechanism from .. to -- ? 
(Possibly by adding an option?)

Thanks for your attention, 
Best regards: OK
___
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] metafun 2

2019-08-14 Thread Aditya Mahajan

On Wed, 14 Aug 2019, Otared Kavian wrote:


Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?

Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun}
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20,
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)",
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
]
xsized 8cm ;
\stopMPcode

\stoptext


This looks like a typical .. vs -- issue. I think there is a way to change 
how the points are connected, but I'll have to look at the code again.


Aditya
___
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] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 4:22 PM, Otared Kavian wrote:

Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?


it doesn't, it just connects the dots, so, just use a smaller step, like

xstep = .01

(The upcoming luagraph module will provide some interpolators so at some 
point we can hook these in.)


(btw, there are a lot of extra math functions, also or complex numbers)


Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun}
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20,
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)",
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
]
xsized 8cm ;
\stopMPcode

\stoptext

%%% end draw-2.tex


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
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Otared Kavian
Hi Hans,

Thank you very much for the new features! I haven't yet read all the 
mag-1104-mkiv.pdf where you explain some of them, but after modifying one of 
your examples, I noticed that some funtions get a strange graph, which is 
probably due to the fact that metafun2 is interpolating between points in a way 
which is not correct.
For instance, in the following example (which is a slight modification of 
yours), the curve drawn is not a graph, in the sense that for some values of x 
it seems to be two or more values of y.

How does metafun 2 traces the curve between two discretization points?

Best regards: OK

%%% begin draw-2.tex

\starttext
\startMPcode{doublefun} 
draw lmt_function [
xmin =  1.0, xmax = 2.5066283, xstep = .1,
ymin = -2, ymax =  2,
%   xticks = "bottom", xsmall = 80, xlarge = 20, 
%   yticks = "left", ysmall = 40, ylarge = 4,
code = "1.5 * math.sin(2*x^2)", 
xlabels = "yes",
ylabels = "yes",
ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
xcaption = "\strut\tfd horizontal",
pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm, 
]
xsized 8cm ;
\stopMPcode

\stoptext

%%% end draw-2.tex



draw-2.pdf
Description: Adobe PDF document


> On 14 Aug 2019, at 11:54, Hans Hagen  wrote:
> 
> Hi,
> 
> In the process of providing an additional (more abstract) interface to some 
> of the old and also new MetaFun code we wonder what kind of features users 
> would like to see.
> 
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> As a teaser I uploaded a MyWay document that shows some of what is coming. 
> All is experimental but it shows the direction. We're talking ConTeXt LMTX 
> here. For instance,
> 
>draw lmt_outline [
>content   = "hello",
>kind  = "reverse",
>fillcolor = "darkred",
>drawcolor = "darkblue",
>rulethickness = 1/2,
>] ysized h shifted (3.75h,-1.25h) ;
> 
> Wraps all the outline drawing in one macro with a set of options (there will 
> be xml interface definitions for that). Or take:
> 
>draw lmt_followtext [
>content = "How well does it work {\bf 1}! ",
>path= (fullcircle scaled 4cm),
>trace   = true,
>spread  = true,
>] ysized 5cm ;
> 
> which is an easier interface to text along a curve. Arrows can be drawn with
> 
>draw lmt_arrow [
>kind= "draw",
>location= "middle",
>alternative = "curved",
>path= fullcircle
>scaled  3cm
>shifted (3.5cm,0cm),
>] withcolor "darkblue" ;
> 
> but of course the low level interface with its many variables for tweaking 
> stays around. Other examples are shown in the mentioned document.
> 
> So the question is: What do you miss in metapost support? Of course it should 
> fit within the concept, so 'artistic freehand drawings' is not something that 
> is likely to get interfaced. We are particularly interested in educational 
> applications, if only because ConTeXt started out that way.
> 
> 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
> ___

___
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] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 1:31 PM, Floris van Manen wrote:

where can i find the steps to install lmtx next to my current context
luatex ?

http://pragma-ade.nl/install.htm

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


Re: [NTG-context] metafun 2

2019-08-14 Thread Floris van Manen
where can i find the steps to install lmtx next to my current context
luatex ?

.F


pEpkey.asc
Description: application/pgp-keys
___
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] metafun 2

2019-08-14 Thread Hans Hagen

On 8/14/2019 12:18 PM, Henri Menke wrote:

Dear Hans,

I just wanted to ask, will LMTX and MetaFun remain valid implementations
of TeX and MetaPost or do we have to expect incompatibilities?
It depends on how you define 'valid' ... we're downward compatible ... 
but LMTX will use features available in luametatex, so when that is the 
case some code will only be available in LMTX (unless i decide to 
backport some). Wrr the TeX part: LMTX is mostly MKIV but it might 
provide extra things (or different implementations). Wrr metapost: lmtx 
can do more advanced things. There is a split context code base.


I expect most users to move on to lmtx anyway at some point. Maybe at 
some point the existing mkiv will be like mkii: frozen.


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
___


Re: [NTG-context] metafun 2

2019-08-14 Thread Henri Menke
Dear Hans,

I just wanted to ask, will LMTX and MetaFun remain valid implementations
of TeX and MetaPost or do we have to expect incompatibilities?

Cheers, Henri

On 14/08/19 9:54 PM, Hans Hagen wrote:
> Hi,
> 
> In the process of providing an additional (more abstract) interface to 
> some of the old and also new MetaFun code we wonder what kind of 
> features users would like to see.
> 
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> As a teaser I uploaded a MyWay document that shows some of what is 
> coming. All is experimental but it shows the direction. We're talking 
> ConTeXt LMTX here. For instance,
> 
>  draw lmt_outline [
>  content   = "hello",
>  kind  = "reverse",
>  fillcolor = "darkred",
>  drawcolor = "darkblue",
>  rulethickness = 1/2,
>  ] ysized h shifted (3.75h,-1.25h) ;
> 
> Wraps all the outline drawing in one macro with a set of options (there 
> will be xml interface definitions for that). Or take:
> 
>  draw lmt_followtext [
>  content = "How well does it work {\bf 1}! ",
>  path= (fullcircle scaled 4cm),
>  trace   = true,
>  spread  = true,
>  ] ysized 5cm ;
> 
> which is an easier interface to text along a curve. Arrows can be drawn 
> with
> 
>  draw lmt_arrow [
>  kind= "draw",
>  location= "middle",
>  alternative = "curved",
>  path= fullcircle
>  scaled  3cm
>  shifted (3.5cm,0cm),
>  ] withcolor "darkblue" ;
> 
> but of course the low level interface with its many variables for 
> tweaking stays around. Other examples are shown in the mentioned document.
> 
> So the question is: What do you miss in metapost support? Of course it 
> should fit within the concept, so 'artistic freehand drawings' is not 
> something that is likely to get interfaced. We are particularly 
> interested in educational applications, if only because ConTeXt started 
> out that way.
> 
> 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
> ___
> 

___
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] metafun 2

2019-08-14 Thread Hans Hagen

Hi,

In the process of providing an additional (more abstract) interface to 
some of the old and also new MetaFun code we wonder what kind of 
features users would like to see.


http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf

As a teaser I uploaded a MyWay document that shows some of what is 
coming. All is experimental but it shows the direction. We're talking 
ConTeXt LMTX here. For instance,


draw lmt_outline [
content   = "hello",
kind  = "reverse",
fillcolor = "darkred",
drawcolor = "darkblue",
rulethickness = 1/2,
] ysized h shifted (3.75h,-1.25h) ;

Wraps all the outline drawing in one macro with a set of options (there 
will be xml interface definitions for that). Or take:


draw lmt_followtext [
content = "How well does it work {\bf 1}! ",
path= (fullcircle scaled 4cm),
trace   = true,
spread  = true,
] ysized 5cm ;

which is an easier interface to text along a curve. Arrows can be drawn 
with


draw lmt_arrow [
kind= "draw",
location= "middle",
alternative = "curved",
path= fullcircle
scaled  3cm
shifted (3.5cm,0cm),
] withcolor "darkblue" ;

but of course the low level interface with its many variables for 
tweaking stays around. Other examples are shown in the mentioned document.


So the question is: What do you miss in metapost support? Of course it 
should fit within the concept, so 'artistic freehand drawings' is not 
something that is likely to get interfaced. We are particularly 
interested in educational applications, if only because ConTeXt started 
out that way.


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
___


Re: [NTG-context] Some macros (Metafun)

2019-08-11 Thread Hans Hagen

On 8/12/2019 12:40 AM, Fabrice Couvreur wrote:

Hi Hans,
Sorry but I did not see your email.
What is the default color used to draw the path p ?


drawlineoptions   (withpen pencircle scaled 1.0 drawoptionsfactor 
withcolor .5white) ;
drawpointoptions  (withpen pencircle scaled 4.0 drawoptionsfactor 
withcolor   black) ;
drawcontroloptions(withpen pencircle scaled 2.5 drawoptionsfactor 
withcolor   black) ;
drawpathoptions   (withpen pencircle scaled 5.0 drawoptionsfactor 
withcolor .8white) ;



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


Re: [NTG-context] Some macros (Metafun)

2019-08-11 Thread Fabrice Couvreur
Hi Hans,
Sorry but I did not see your email.
What is the default color used to draw the path p ?
Thank you.

Le ven. 9 août 2019 à 13:12, Hans Hagen  a écrit :

> On 8/9/2019 10:57 AM, Fabrice Couvreur wrote:
> > Hello,
> > In the Metafun manual, Hans uses macros like drawpath p ;
> > drawcontrollines p ; drawpoints p ; drawcontrolpoints p ...
> > How to use them in a document ?
> > Where to find source codes ?
> > For example, the following code does not work :
> >
> > \starttext
> > \startuseMPgraphic{path}
> > path p ; p := (1cm,1cm)--(1.5cm,1.5cm)..(2cm,0cm)..cycle ;
> > \stopuseMPgraphic
> >
> > \startMPcode
> >p := p .. cycle ; swappointlabels := true ;
> >drawpath p ;
> > \stopMPcode
> > \stoptext
> \starttext
>
> \startMPcode
>  path p ; p := (1cm,1cm)--(1.5cm,1.5cm)..(2cm,0cm)..cycle ;
>  drawpath p ;
>  drawpoints p ;
>  drawpointlabels p ;
>  drawcontrolpoints p ;
>  drawcontrollines p ;
> \stopMPcode
>
> \stoptext
>
>
> -
>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
>
> ___
>
___
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] Some macros (Metafun)

2019-08-09 Thread Hans Hagen

On 8/9/2019 10:57 AM, Fabrice Couvreur wrote:

Hello,
In the Metafun manual, Hans uses macros like drawpath p ; 
drawcontrollines p ; drawpoints p ; drawcontrolpoints p ...

How to use them in a document ?
Where to find source codes ?
For example, the following code does not work :

\starttext
\startuseMPgraphic{path}
    path p ; p := (1cm,1cm)--(1.5cm,1.5cm)..(2cm,0cm)..cycle ;
\stopuseMPgraphic

\startMPcode
   p := p .. cycle ; swappointlabels := true ;
   drawpath p ;
\stopMPcode
\stoptext

\starttext

\startMPcode
path p ; p := (1cm,1cm)--(1.5cm,1.5cm)..(2cm,0cm)..cycle ;
drawpath p ;
drawpoints p ;
drawpointlabels p ;
drawcontrolpoints p ;
drawcontrollines p ;
\stopMPcode

\stoptext


-
  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] Some macros (Metafun)

2019-08-09 Thread Fabrice Couvreur
Hello,
In the Metafun manual, Hans uses macros like drawpath p ; drawcontrollines
p ; drawpoints p ; drawcontrolpoints p ...
How to use them in a document ?
Where to find source codes ?
For example, the following code does not work :

\starttext
\startuseMPgraphic{path}
   path p ; p := (1cm,1cm)--(1.5cm,1.5cm)..(2cm,0cm)..cycle ;
\stopuseMPgraphic

\startMPcode
  p := p .. cycle ; swappointlabels := true ;
  drawpath p ;
\stopMPcode
\stoptext


Thank you
Fabrice
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread luigi scarso
On Thu, Mar 14, 2019 at 10:52 AM Hans Hagen  wrote:

> as currently the variable is isn't used we can also comment it
>
>
>
seems so
I have commented the line, and all formats and the plain test run.


-- 
luigi
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 10:00 AM, Henri Menke wrote:

On 3/14/19 8:49 PM, Hans Hagen wrote:

On 3/14/2019 5:56 AM, Henri Menke wrote:


Dear list,

Something has changed in MetaFun and it can no longer be used in plain
LuaTeX,
with neither of

  luatex test.tex
  mtxrun --script plain test.tex

This is the error:

  >> LUATEXFUNCTIONALITY
  >> "mp.print(LUATEXFUNCTIONALITY)"
  ! Equation cannot be performed (numeric=string).


hm, that can be

mp.print(LUATEXFUNCTIONALITY or 0)

but ... i'm surprised you can use metafun in plain at all ... i never
test that and to be honest am not too motivated to support mpiv code in
generic either .. better use


Until TeX Live 2018, MetaFun worked in plain (at least the subset I'm
using).  It would be a shame if the support would end.  I also think
that there are quite a number of users.  The number of posts on TeX
Stack Exchange mentioning luamplib with metafun is not negligible.
https://tex.stackexchange.com/search?q=mplibsetformat


ok, as long as no one expects me to check functionality in plain usage

things like special colors and shading and some font related options 
won't work, so in that case the stand alone graphics are better


(there are quite some metafun macros that assume the lua extensions that 
context provides and some upcoming extra modules, for sure will not work 
in plain ... no problem as long as these macros are not used ...)



I (and probably a lot of other people) would really appreciate if you
could apply Luigi's fix, so we can continue do enjoy MetaFun, even
outside ConTeXt.

i'll comment the line

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
___


Re: [NTG-context] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 8:51 AM, luigi scarso wrote:



On Thu, Mar 14, 2019 at 5:56 AM Henri Menke <mailto:henrime...@gmail.com>> wrote:



Dear list,

Something has changed in MetaFun and it can no longer be used in
plain LuaTeX,
with neither of

     luatex test.tex
     mtxrun --script plain test.tex

This is the error:

     >> LUATEXFUNCTIONALITY
     >> "mp.print(LUATEXFUNCTIONALITY)"
     ! Equation cannot be performed (numeric=string).

MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

local function finder(name, mode, ftype)
     if mode == "w" then
         return name
     else
         return mpkpse:find_file(name,ftype)
     end
end

local mpx = mplib.new {
     find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp <http://metafun.mp> ;
]]

print(ret.log)
}
\bye


in mp-mlib.mpiv it seems that we should have
string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

instead of
numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

Now I have
tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY
mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
mp-mlib.mpiv:string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;


and your example looks ok.

as currently the variable is isn't used we can also comment it

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
___


Re: [NTG-context] Can't use MetaFun with mplib anymore

2019-03-14 Thread Henri Menke
On 3/14/19 8:49 PM, Hans Hagen wrote:
> On 3/14/2019 5:56 AM, Henri Menke wrote:
>>
>> Dear list,
>>
>> Something has changed in MetaFun and it can no longer be used in plain
>> LuaTeX,
>> with neither of
>>
>>  luatex test.tex
>>  mtxrun --script plain test.tex
>>
>> This is the error:
>>
>>  >> LUATEXFUNCTIONALITY
>>  >> "mp.print(LUATEXFUNCTIONALITY)"
>>  ! Equation cannot be performed (numeric=string).
> 
> hm, that can be
> 
> mp.print(LUATEXFUNCTIONALITY or 0)
> 
> but ... i'm surprised you can use metafun in plain at all ... i never
> test that and to be honest am not too motivated to support mpiv code in
> generic either .. better use

Until TeX Live 2018, MetaFun worked in plain (at least the subset I'm
using).  It would be a shame if the support would end.  I also think
that there are quite a number of users.  The number of posts on TeX
Stack Exchange mentioning luamplib with metafun is not negligible.
https://tex.stackexchange.com/search?q=mplibsetformat

I (and probably a lot of other people) would really appreciate if you
could apply Luigi's fix, so we can continue do enjoy MetaFun, even
outside ConTeXt.

Cheers, Henri

> 
> \startMPpage
> \stopMPpage
> 
> with context and then include the pdf
> 
> Hans
> 
>> MWE is below, as always.
>>
>> Cheers, Henri
>>
>> ---
>>
>> \directlua{
>> local mpkpse = kpse.new(arg[0], "mpost")
>>
>> local function finder(name, mode, ftype)
>>  if mode == "w" then
>>  return name
>>  else
>>  return mpkpse:find_file(name,ftype)
>>  end
>> end
>>
>> local mpx = mplib.new {
>>  find_file = finder
>> }
>> local ret = mpx:execute[[
>> boolean mplib ; mplib := true ;
>> input metafun.mp ;
>> ]]
>>
>> print(ret.log)
>> }
>> \bye
>>
>> ___
>>
>> 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] Can't use MetaFun with mplib anymore

2019-03-14 Thread luigi scarso
On Thu, Mar 14, 2019 at 5:56 AM Henri Menke  wrote:

>
> Dear list,
>
> Something has changed in MetaFun and it can no longer be used in plain
> LuaTeX,
> with neither of
>
> luatex test.tex
> mtxrun --script plain test.tex
>
> This is the error:
>
> >> LUATEXFUNCTIONALITY
> >> "mp.print(LUATEXFUNCTIONALITY)"
> ! Equation cannot be performed (numeric=string).
>
> MWE is below, as always.
>
> Cheers, Henri
>
> ---
>
> \directlua{
> local mpkpse = kpse.new(arg[0], "mpost")
>
> local function finder(name, mode, ftype)
> if mode == "w" then
> return name
> else
> return mpkpse:find_file(name,ftype)
> end
> end
>
> local mpx = mplib.new {
> find_file = finder
> }
> local ret = mpx:execute[[
> boolean mplib ; mplib := true ;
> input metafun.mp ;
> ]]
>
> print(ret.log)
> }
> \bye
>
>
in mp-mlib.mpiv it seems that we should have
string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
instead of
numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

Now I have
tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY
mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
mp-mlib.mpiv:string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

and your example looks ok.

-- 
luigi
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 5:56 AM, Henri Menke wrote:


Dear list,

Something has changed in MetaFun and it can no longer be used in plain LuaTeX,
with neither of

 luatex test.tex
 mtxrun --script plain test.tex

This is the error:

 >> LUATEXFUNCTIONALITY
 >> "mp.print(LUATEXFUNCTIONALITY)"
 ! Equation cannot be performed (numeric=string).


hm, that can be

mp.print(LUATEXFUNCTIONALITY or 0)

but ... i'm surprised you can use metafun in plain at all ... i never 
test that and to be honest am not too motivated to support mpiv code in 
generic either .. better use


\startMPpage
\stopMPpage

with context and then include the pdf

Hans


MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

local function finder(name, mode, ftype)
 if mode == "w" then
 return name
 else
 return mpkpse:find_file(name,ftype)
 end
end

local mpx = mplib.new {
 find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp ;
]]

print(ret.log)
}
\bye

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




--

-
  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] Can't use MetaFun with mplib anymore

2019-03-13 Thread Henri Menke

Dear list,

Something has changed in MetaFun and it can no longer be used in plain LuaTeX,
with neither of

luatex test.tex
mtxrun --script plain test.tex

This is the error:

>> LUATEXFUNCTIONALITY
>> "mp.print(LUATEXFUNCTIONALITY)"
! Equation cannot be performed (numeric=string).

MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

local function finder(name, mode, ftype)
if mode == "w" then
return name
else
return mpkpse:find_file(name,ftype)
end
end

local mpx = mplib.new {
find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp ;
]]

print(ret.log)
}
\bye

___
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] getdocumentargument in Metafun

2019-02-22 Thread Fabrice L
Le 22 février 2019 à 11:08:51, Aditya Mahajan (adit...@umich.edu) a écrit:

Untested. Add quotes around FileName:

> string FileName ;
> FileName := "\getdocumentargument{File}" ;


And not tested successfully !

Thanks a lot Aditya !

Fabrice.



Aditya___
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] getdocumentargument in Metafun

2019-02-22 Thread Aditya Mahajan

On Fri, 22 Feb 2019, Fabrice L wrote:


Dear list,

I wish to do several zoom from a picture made in MetaFun, from a pdf file
which name is given on the commande line, like:

context zoom.tex —File=EntryFile —Page=9 —result=OutFile.pdf


Untested. Add quotes around FileName:


string FileName ;
FileName := "\getdocumentargument{File}" ;


Aditya___
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] getdocumentargument in Metafun

2019-02-22 Thread Fabrice L
Dear list,

I wish to do several zoom from a picture made in MetaFun, from a pdf file
which name is given on the commande line, like:

context zoom.tex —File=EntryFile —Page=9 —result=OutFile.pdf

Minimal example:

\starttext
  \startMPpage
numeric ThePage ;
string FileName ;
FileName := \getdocumentargument{File} ;
ThePage := \getdocumentargument{Page} ;
draw textext("\externalfigure["  & FileName &"][page="  & ThePage &"]")
xysized (48in,48in) ;
  \stopMPpage
\stoptext

I can get in the MPpage the page number in entry (9 in my example), but not
the file name.
Thanks for any help.
Fabrice.
___
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] outlined font using MetaFun

2019-02-08 Thread Wolfgang Schuster

Jeong Dal schrieb am 08.02.19 um 17:18:

Dear all,

The following code which is borrowed from MetaFun manual is working nicely.

%%
\setupMPvariables[outlineT][tt="Hello"]
\startuseMPgraphic{outlineT}
   draw outlinetext.b (\MPvar{tt})
   (withcolor .5white)
   (withcolor .625blue withpen pencircle scaled .2pt)
   scaled 3 ;
\stopuseMPgraphic

\starttext
\useMPgraphic{outlineT}
\stoptext


However, the next example is not working(without \setupMPvariables[]).

%%%
\startuseMPgraphic{outlineT}{tt}
   draw outlinetext.b (\MPvar{tt})
   (withcolor .5white)
   (withcolor .625blue withpen pencircle scaled .2pt)
   scaled 3 ;
\stopuseMPgraphic

\starttext
\useMPgraphic{outlineT}{tt=“Hello”}
\stoptext


So, the trial to use above code for chapter title as following didn’t work 
either.

\startuseMPgraphic{outlineT}{tt}
string tt;
   draw outlinetext.b (\MPvar{tt})
   (withcolor .5white)
   (withcolor .625blue withpen pencircle scaled .2pt)
   scaled 3 ;
\stopuseMPgraphic
\define[1]\myTest{\useMPgraphic{outlineT}{#1}}

\setuphead[chapter]
  [textcommand=\myTest,
  numbercommand=\myTest,
number=yes]

\starttext
\startchapter[title={First chapter}]

  Chapter

\stopchapter
\stoptext
%%%

Is there any way to make it work?


Drop the list with variables after \startuseMPgraphic.

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
___


[NTG-context] outlined font using MetaFun

2019-02-08 Thread Jeong Dal
Dear all,

The following code which is borrowed from MetaFun manual is working nicely.

%%
\setupMPvariables[outlineT][tt="Hello"]
\startuseMPgraphic{outlineT}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .5white)
  (withcolor .625blue withpen pencircle scaled .2pt)
  scaled 3 ;
\stopuseMPgraphic

\starttext
\useMPgraphic{outlineT}
\stoptext


However, the next example is not working(without \setupMPvariables[]).

%%%
\startuseMPgraphic{outlineT}{tt}
  draw outlinetext.b (\MPvar{tt})
  (withcolor .5white)
  (withcolor .625blue withpen pencircle scaled .2pt)
  scaled 3 ;
\stopuseMPgraphic

\starttext
\useMPgraphic{outlineT}{tt=“Hello”}
\stoptext


So, the trial to use above code for chapter title as following didn’t work 
either.

\startuseMPgraphic{outlineT}{tt}
string tt;
  draw outlinetext.b (\MPvar{tt})
  (withcolor .5white)
  (withcolor .625blue withpen pencircle scaled .2pt)
  scaled 3 ;
\stopuseMPgraphic
\define[1]\myTest{\useMPgraphic{outlineT}{#1}}

\setuphead[chapter]
 [textcommand=\myTest,
 numbercommand=\myTest,
number=yes]

\starttext
\startchapter[title={First chapter}]

 Chapter

\stopchapter
\stoptext
%%%

Is there any way to make it work?

thank you.

Best regards,

Dalyoung

___
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] textext with plain MetaFun

2019-01-21 Thread Akira Kakuto
> You should see the text at the bottom left.
> It seems that there is a string _s_  not initialized.

If I remove all _s_ in mp-text.mpii,
metafun test.mp
worked for

hobbiestextext := true;
beginfig(1)
draw textext("MetaFun") ;
endfig;
end.

Best,
Akira
___
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] textext with plain MetaFun

2019-01-21 Thread luigi scarso
On Mon, Jan 21, 2019 at 10:47 AM Henri Menke  wrote:

> On 1/21/19 10:40 PM, luigi scarso wrote:
> > On Mon, Jan 21, 2019 at 8:57 AM Henri Menke 
> wrote:
> >
> >> Dear list,
> >>
> >> When I process the short MetaFun example
> >>
> >> beginfig(1)
> >> draw textext("MetaFun") ;
> >> endfig;
> >> end
> >>
> >> with plain MetaFun, i.e.
> >>
> >> mpost '&metafun' test.mp
> >>
> >>
> >  what does
> > $> mpost -mem=metafun '\relax; tracingall; input test.mp;'
> > say ?
>
> Log is attached.
>

hm.

# cat test.mp
hobbiestextext := true;
beginfig(1)
draw textext("MetaFun") ;
endfig;
end

# mpost -interaction=batchmode -mem=metafun '\relax;   input test.mp;'

# gs test.1

You should see the text at the bottom left.  It seems that there is a
string _s_  not initialized.

-- 
luigi
___
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] textext with plain MetaFun

2019-01-21 Thread Henri Menke
On 1/21/19 10:40 PM, luigi scarso wrote:
> On Mon, Jan 21, 2019 at 8:57 AM Henri Menke  wrote:
> 
>> Dear list,
>>
>> When I process the short MetaFun example
>>
>>     beginfig(1)
>> draw textext("MetaFun") ;
>> endfig;
>> end
>>
>> with plain MetaFun, i.e.
>>
>> mpost '&metafun' test.mp
>>
>>
>  what does
> $> mpost -mem=metafun '\relax; tracingall; input test.mp;'
> say ?

Log is attached.

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

This is MetaPost, version 2.00 (TeX Live 2018) (kpathsea version 6.3.0)  21 JAN 2019 22:45
**\relax; tracingall; input test.mp;
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/common/metafun.mp
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/metafun.mpii
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-base.mpii
Preloading the plain mem file, version 1.004 for metafun ii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-tool.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-spec.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-core.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-page.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-text.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-txts.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-shap.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-butt.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-char.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-step.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-grph.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-figs.mpii)
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-grid.mpii
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-form.mpii
(/usr/local/texlive/2018/texmf-dist/metapost/base/string.mp)
(/usr/local/texlive/2018/texmf-dist/metapost/base/marith.mp
(/usr/local/texlive/2018/texmf-dist/metapost/base/string.mp
(/usr/local/texlive/2018/texmf-dist/metapost/context/base/mpii/mp-func.mpii)))
{tracingtitles:=1}
{tracingequations:=1}
{tracingcapsules:=1}
{tracingspecs:=2}
{tracingchoices:=1}
{tracinglostchars:=1}
{tracingstats:=1}
{tracingoutput:=1}
{tracingmacros:=1}
{tracingrestores:=1}
{input}
(./test.mp
beginfig(EXPR0)->_fig_nesting_:=_fig_nesting_+1;if._fig_nesting_=1:begingroup.c
harcode:=(EXPR0);resetfig;scantokens.extra_beginfig;fi;
(EXPR0)<-1
{(0)+(1)}
{_fig_nesting_:=1}
## _fig_nesting_=1
{if}
{(1)=(1)}
{true}
{begingroup}
{charcode:=1}

resetfig->clearxy;clearit;clearpen;pickup.defaultpen;interim.linecap:=linecap;i
nterim.linejoin:=linejoin;interim.miterlimit:=miterlimit;save._background_;colo
r._background_;_background_:=background;save.background;color.background;backgr
ound:=_background_;drawoptions();

clearxy->if.false.for$:=(TEXT0):or.true.endfor:forsuffixes$:=(TEXT0):x$:=
whatever;y$:=whatever;endfor;else:save.x,y;fi
(TEXT0)<-
{if}
{false}
{for}
{false}
{save}
{fi}

clearit->currentpicture:=nullpicture
{nullpicture}
{currentpicture:=picture}

clearpen->currentpen:=nullpen;pen_lft:=pen_rt:=pen_top:=pen_bot:=0;path.current
pen_path;
{nullpen}
{currentpen:=pen}
{pen_bot:=0}
{pen_top:=0}
{pen_rt:=0}
{pen_lft:=0}
{path}

pickup->if.numeric(EXPR0):numeric_pickup_.else:pen_pickup_.fi(EXPR0)
(EXPR0)<-1
{if}
{numeric(1)}
{true}

numeric_pickup_->if.unknown.pen_[(EXPR0)]:errmessage"Unknown pen";clea
rpen.else:currentpen:=pen_[(EXPR0)];pen_lft:=pen_lft_[(EXPR0)];pen_rt:=pen_rt_[
(EXPR0)];pen_top:=pen_top_[(EXPR0)];pen_bot:=pen_bot_[(EXPR0)];currentpen_path:
=pen_path_[(EXPR0)]fi;
{else}
(EXPR0)<-1
{if}
{unknown(pen)}
{false}
{currentpen:=pen}
{pen_lft:=-0.25}
{pen_rt:=0.25}
{pen_top:=0.25}
{pen_bot:=-0.25}
{fi}
{currentpen_path:=unknown path pen_path_1}
{interim}
{linecap:=1}
{interim}
{linejoin:=1}
{interim}
{miterlimit:=10}
{save}
{color}
{_background_:=(1,1,1)}
## bluepart _background_=1
## greenpart _background_=1
## redpart _background_=1
{save}
{color}
{background:=(1,1,1)}
## bluepart background=1
## greenpart background=1
## redpart background=1

drawoptions(TEXT0)->def._op_=(TEXT0)enddef
(TEXT0)<-
{def}
{scantokens}
{true

Re: [NTG-context] textext with plain MetaFun

2019-01-21 Thread luigi scarso
On Mon, Jan 21, 2019 at 8:57 AM Henri Menke  wrote:

> Dear list,
>
> When I process the short MetaFun example
>
> beginfig(1)
> draw textext("MetaFun") ;
> endfig;
> end
>
> with plain MetaFun, i.e.
>
> mpost '&metafun' test.mp
>
>
 what does
$> mpost -mem=metafun '\relax; tracingall; input test.mp;'
say ?

-- 
luigi
___
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] textext with plain MetaFun

2019-01-21 Thread Hans van der Meer
The following always worked for me:

\starttext
\startMPpage
.. metapost code ..
\stopMPpage
\stoptext

and delivered from a ConTeXt-run a separate pdf.

dr. Hans van der Meer


> On 21 Jan 2019, at 09:43, Henri Menke  wrote:
> 
> On 1/21/19 9:29 PM, Hans Hagen wrote:
>> On 1/21/2019 8:57 AM, Henri Menke wrote:
>>> Dear list,
>>> 
>>> When I process the short MetaFun example
>>> 
>>>  beginfig(1)
>>>  draw textext("MetaFun") ;
>>>  endfig;
>>>  end
>>> 
>>> with plain MetaFun, i.e.
>>> 
>>>  mpost '&metafun' test.mp
>>> 
>>> the resulting file only contains “unknown”.  How can I get the expected
>>> output?
>> context foo.mp
>> 
>> (in mkii one could use mptopdf but i have no interest in figuring out
>> some pure metapost solution when we can do the job with simple wrapping
>> in mkiv as mentioned)
> 
> I tried
> 
>mpost '&metafun' test.mp
>mptopdf test.1
> 
> and now I have a PDF which says “unknown“.  Maybe I didn't understand
> what you meant.
> 
> Cheers, Henri
> 
>> 
>> 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
> ___

___
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] textext with plain MetaFun

2019-01-21 Thread Henri Menke
On 1/21/19 9:29 PM, Hans Hagen wrote:
> On 1/21/2019 8:57 AM, Henri Menke wrote:
>> Dear list,
>>
>> When I process the short MetaFun example
>>
>>  beginfig(1)
>>  draw textext("MetaFun") ;
>>  endfig;
>>  end
>>
>> with plain MetaFun, i.e.
>>
>>  mpost '&metafun' test.mp
>>
>> the resulting file only contains “unknown”.  How can I get the expected
>> output?
> context foo.mp
> 
> (in mkii one could use mptopdf but i have no interest in figuring out
> some pure metapost solution when we can do the job with simple wrapping
> in mkiv as mentioned)

I tried

mpost '&metafun' test.mp
mptopdf test.1

and now I have a PDF which says “unknown“.  Maybe I didn't understand
what you meant.

Cheers, Henri

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

Re: [NTG-context] textext with plain MetaFun

2019-01-21 Thread Hans Hagen

On 1/21/2019 8:57 AM, Henri Menke wrote:

Dear list,

When I process the short MetaFun example

 beginfig(1)
 draw textext("MetaFun") ;
 endfig;
 end

with plain MetaFun, i.e.

     mpost '&metafun' test.mp

the resulting file only contains “unknown”.  How can I get the expected
output?

context foo.mp

(in mkii one could use mptopdf but i have no interest in figuring out 
some pure metapost solution when we can do the job with simple wrapping 
in mkiv as mentioned)


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
___

[NTG-context] textext with plain MetaFun

2019-01-20 Thread Henri Menke
Dear list,

When I process the short MetaFun example

beginfig(1)
draw textext("MetaFun") ;
endfig;
end

with plain MetaFun, i.e.

    mpost '&metafun' test.mp

the resulting file only contains “unknown”.  How can I get the expected
output?

Cheers, Henri

___
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] MetaFun: how to check the number of arguments

2019-01-16 Thread Jeong Dal
Dear Hans,

> vardef textlength(text t) =
>save n ; n := 0 ;
>for i = t :
>   n := n + 1 ;
>endfor;
>n
> enddef;
> 

Thank you for a  good method!
It can be used in another program.

Best regards,

Dalyoung
___
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] MetaFun: how to check the number of arguments

2019-01-16 Thread Hans Hagen

On 1/16/2019 12:53 AM, Jeong Dal wrote:

Dear Hans,

Thank you for a solution.

In my memory, it is possible to check the argument in Lua, so I hope 
that there is a similar method in MetaFun.

It may be easier to draw grid using lines instead of squares.


vardef textlength(text t) =
save n ; n := 0 ;
for i = t :
n := n + 1 ;
endfor;
n
enddef;

def drawGridF (expr nb) (text s) =
if textlength(s) = 0 :
   draw textext("A grid!");
else :
   path p ;
   picture pic ;
   numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
fi ;
enddef;



Thank you again.

Best regards,

Dalyoung

2019. 1. 16. 오전 2:04, Hans Hagen <mailto:j.ha...@xs4all.nl>> 작성:


On 1/14/2019 10:44 PM, Jeong Dal wrote:

Dear all,
In the following sample, it draws squares with label which is given.
I’d like to know how to check the number of elements in the second 
argument?

If it is 0, then I just draw grids only.
Thank you for reading.
Best regards,
Dalyoung

\startbuffer[defs]
def drawGridF (expr nb) (text s) =
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
enddef;
\stopbuffer
\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
\stopbuffer
\starttext
\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]
\stoptext



\startbuffer[defs]
def drawGridF (expr nb) (text s) =
   path p ;
   picture pic ;
   numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
   if n == 0 :
   draw textext("A grid!");
   fi ;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
drawGridF (3)  ();
\stopbuffer

\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]




2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 
<mailto:ntg-context-requ...@ntg.nl> 작성:


Send ntg-context mailing list submissions to
ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.ntg.nl/mailman/listinfo/ntg-context
or, via email, send a message with subject or body 'help' to
ntg-context-requ...@ntg.nl

You can reach the person managing the list at
ntg-context-ow...@ntg.nl

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ntg-context digest..."


Today's Topics:

  1. Re: Manipulating the left blank page when chapter starts on
 the right page (Wolfgang Schuster)
  2. Re: Footnotes in float combinations missing in output
 (Wolfgang Schuster)
  3. Re: Manipulating the left blank page when chapter starts on
 the right page (Jan U. Hasecke)


--

Message: 1
Date: Sun, 13 Jan 2019 16:56:40 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , "Jan U.
Hasecke" 
Subject: Re: [NTG-context] Manipulating the left blank page when
chapter starts on the right page
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Jan U. Hasecke schrieb am 12.01.19 um 22:08:

Hi Aditya,

Am 12.01.19 um 20:11 schrieb Aditya Mahajan:

On Sat, 12 Jan 2019, Jan U. Hasecke wrote:


Hi all,

in my document \startchapter and \starttitle starts a new chapter 
on the
right (odd) page. So sometimes, there is a blank even page just 
before a

new chapter.

I would like to manipulate this blank even page.

There are several things I would like to do, eg. having no 
headers and
footers, setting the background color to a named color, placing 
an image

or some graphics on the page.

Is there a way to define such a page, name it and call it in
\startchapter so that it is placed on the left side.

See https://tex.stackexchange.com/q/457428/323
Thanks a lot, but I wasn't looking for a way to just delete page 
numbers

but to style the empty page in arbitrary ways.

Maybe it is better to do this manually.

I would let chapter open on even pages too and just insert a styled 
page

by hand.


Here is a example which shows how you can change the background color
of a empty page before the chapter title.

\setuppagenumbering
  [alternative=doublesided]

\startsetups [chapter:before]
  \doifoddpageelse
{}
{\pushbackground[page]
 \setupbackgrounds[page][background=color,backgroundcolor=black]
 \page[empty,right]
 \popbackground}
\stopsetups

\setuphead
  [chapter]
  [page=yes,
   before=\directsetup{chapter:before}]

\startt

Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-15 Thread Jeong Dal
Dear Hans,

Thank you for a solution.

In my memory, it is possible to check the argument in Lua, so I hope that there 
is a similar method in MetaFun.
It may be easier to draw grid using lines instead of squares.

Thank you again.

Best regards,

Dalyoung

> 2019. 1. 16. 오전 2:04, Hans Hagen  작성:
> 
> On 1/14/2019 10:44 PM, Jeong Dal wrote:
>> Dear all,
>> In the following sample, it draws squares with label which is given.
>> I’d like to know how to check the number of elements in the second argument?
>> If it is 0, then I just draw grids only.
>> Thank you for reading.
>> Best regards,
>> Dalyoung
>> 
>> \startbuffer[defs]
>> def drawGridF (expr nb) (text s) =
>>  p := unitsquare scaled wu;
>>  n:= 0;
>>  for m = s:
>>  i:= n mod nb;
>>  j:= n div nb;
>>  pic := image (draw p; label(textext(m), center p); );
>>  draw pic shifted (i*wu, j*wu);
>>  n:= n+ 1;
>>  endfor;
>> enddef;
>> \stopbuffer
>> \startbuffer[3x3b]
>> wu := \MPvar{width};
>> drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
>> \stopbuffer
>> \starttext
>> \setupMPvariables[width=30pt]
>> \processMPbuffer[defs,3x3b]
>> \stoptext
> 
> 
> \startbuffer[defs]
> def drawGridF (expr nb) (text s) =
>path p ;
>picture pic ;
>numeric n;
>   p := unitsquare scaled wu;
>   n:= 0;
>   for m = s:
>   i:= n mod nb;
>   j:= n div nb;
>   pic := image (draw p; label(textext(m), center p); );
>   draw pic shifted (i*wu, j*wu);
>   n:= n+ 1;
>   endfor;
>if n == 0 :
>draw textext("A grid!");
>fi ;
> enddef;
> \stopbuffer
> 
> \startbuffer[3x3b]
> wu := \MPvar{width};
> drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
> currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
> drawGridF (3)  ();
> \stopbuffer
> 
> \setupMPvariables[width=30pt]
> \processMPbuffer[defs,3x3b]
> 
> 
> 
> 
>>> 2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 작성:
>>> 
>>> Send ntg-context mailing list submissions to
>>> ntg-context@ntg.nl
>>> 
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> https://mailman.ntg.nl/mailman/listinfo/ntg-context
>>> or, via email, send a message with subject or body 'help' to
>>> ntg-context-requ...@ntg.nl
>>> 
>>> You can reach the person managing the list at
>>> ntg-context-ow...@ntg.nl
>>> 
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of ntg-context digest..."
>>> 
>>> 
>>> Today's Topics:
>>> 
>>>   1. Re: Manipulating the left blank page when chapter starts on
>>>  the right page (Wolfgang Schuster)
>>>   2. Re: Footnotes in float combinations missing in output
>>>  (Wolfgang Schuster)
>>>   3. Re: Manipulating the left blank page when chapter starts on
>>>  the right page (Jan U. Hasecke)
>>> 
>>> 
>>> --
>>> 
>>> Message: 1
>>> Date: Sun, 13 Jan 2019 16:56:40 +0100
>>> From: Wolfgang Schuster 
>>> To: mailing list for ConTeXt users , "Jan U.
>>> Hasecke" 
>>> Subject: Re: [NTG-context] Manipulating the left blank page when
>>> chapter starts on the right page
>>> Message-ID: 
>>> Content-Type: text/plain; charset=utf-8; format=flowed
>>> 
>>> Jan U. Hasecke schrieb am 12.01.19 um 22:08:
>>>> Hi Aditya,
>>>> 
>>>> Am 12.01.19 um 20:11 schrieb Aditya Mahajan:
>>>>> On Sat, 12 Jan 2019, Jan U. Hasecke wrote:
>>>>> 
>>>>>> Hi all,
>>>>>> 
>>>>>> in my document \startchapter and \starttitle starts a new chapter on the
>>>>>> right (odd) page. So sometimes, there is a blank even page just before a
>>>>>> new chapter.
>>>>>> 
>>>>>> I would like to manipulate this blank even page.
>>>>>> 
>>>>>> There are several things I would like to do, eg. having no headers and
>>>>>> footers, setting the background color to a named color, placing an image
>>>>>> or some graphics on the page.
>>>>>> 
>>>>>> Is there a way to define such a page,

Re: [NTG-context] MetaFun: how to check the number of arguments

2019-01-15 Thread Hans Hagen

On 1/14/2019 10:44 PM, Jeong Dal wrote:

Dear all,

In the following sample, it draws squares with label which is given.

I’d like to know how to check the number of elements in the second argument?
If it is 0, then I just draw grids only.

Thank you for reading.
Best regards,

Dalyoung


\startbuffer[defs]
def drawGridF (expr nb) (text s) =
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
\stopbuffer

\starttext
\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]
\stoptext



\startbuffer[defs]
def drawGridF (expr nb) (text s) =
path p ;
picture pic ;
numeric n;
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
if n == 0 :
draw textext("A grid!");
fi ;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
currentpicture := currentpicture shifted (bbwidth(currentpicture),0);
drawGridF (3)  ();
\stopbuffer

\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]





2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 작성:

Send ntg-context mailing list submissions to
ntg-context@ntg.nl

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.ntg.nl/mailman/listinfo/ntg-context
or, via email, send a message with subject or body 'help' to
ntg-context-requ...@ntg.nl

You can reach the person managing the list at
ntg-context-ow...@ntg.nl

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ntg-context digest..."


Today's Topics:

   1. Re: Manipulating the left blank page when chapter starts on
  the right page (Wolfgang Schuster)
   2. Re: Footnotes in float combinations missing in output
  (Wolfgang Schuster)
   3. Re: Manipulating the left blank page when chapter starts on
  the right page (Jan U. Hasecke)


--

Message: 1
Date: Sun, 13 Jan 2019 16:56:40 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , "Jan U.
Hasecke" 
Subject: Re: [NTG-context] Manipulating the left blank page when
chapter starts on the right page
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Jan U. Hasecke schrieb am 12.01.19 um 22:08:

Hi Aditya,

Am 12.01.19 um 20:11 schrieb Aditya Mahajan:

On Sat, 12 Jan 2019, Jan U. Hasecke wrote:


Hi all,

in my document \startchapter and \starttitle starts a new chapter on the
right (odd) page. So sometimes, there is a blank even page just before a
new chapter.

I would like to manipulate this blank even page.

There are several things I would like to do, eg. having no headers and
footers, setting the background color to a named color, placing an image
or some graphics on the page.

Is there a way to define such a page, name it and call it in
\startchapter so that it is placed on the left side.

See https://tex.stackexchange.com/q/457428/323

Thanks a lot, but I wasn't looking for a way to just delete page numbers
but to style the empty page in arbitrary ways.

Maybe it is better to do this manually.

I would let chapter open on even pages too and just insert a styled page
by hand.


Here is a example which shows how you can change the background color
of a empty page before the chapter title.

\setuppagenumbering
   [alternative=doublesided]

\startsetups [chapter:before]
   \doifoddpageelse
 {}
 {\pushbackground[page]
  \setupbackgrounds[page][background=color,backgroundcolor=black]
  \page[empty,right]
  \popbackground}
\stopsetups

\setuphead
   [chapter]
   [page=yes,
before=\directsetup{chapter:before}]

\starttext

\startchapter[title={Knuth}]
\dorecurse{10}{\samplefile{knuth}}
\stopchapter

\startchapter[title={Zapf}]
\dorecurse{10}{\samplefile{zapf}}
\stopchapter

\startchapter[title={Ward}]
\dorecurse{10}{\samplefile{ward}}
\stopchapter

\stoptext

Wolfgang



--

Message: 2
Date: Sun, 13 Jan 2019 21:06:42 +0100
From: Wolfgang Schuster 
To: mailing list for ConTeXt users , Lars

Subject: Re: [NTG-context] Footnotes in float combinations missing in
output
Message-ID: 
Content-Type: text/plain; charset=utf-8; format=flowed

Lars schrieb am 09.01.19 um 23:01:

Hi there, hi Hans,

I just want to let you know that footnotes insterted in
float-combinations don't get rendered properly, i. e. only the last
footnote is placed in the output. MWE:

\starttext
 

[NTG-context] MetaFun: how to check the number of arguments

2019-01-14 Thread Jeong Dal
Dear all,

In the following sample, it draws squares with label which is given.

I’d like to know how to check the number of elements in the second argument?
If it is 0, then I just draw grids only.

Thank you for reading.
Best regards,

Dalyoung


\startbuffer[defs]
def drawGridF (expr nb) (text s) = 
p := unitsquare scaled wu;
n:= 0;
for m = s:
i:= n mod nb;
j:= n div nb;
pic := image (draw p; label(textext(m), center p); );
draw pic shifted (i*wu, j*wu);
n:= n+ 1;
endfor;
enddef;
\stopbuffer

\startbuffer[3x3b]
wu := \MPvar{width};
drawGridF (3)  (1,2,3,0,1, 1,4,5,8);
\stopbuffer

\starttext
\setupMPvariables[width=30pt]
\processMPbuffer[defs,3x3b]
\stoptext

> 2019. 1. 14. 오후 8:00, ntg-context-requ...@ntg.nl 작성:
> 
> Send ntg-context mailing list submissions to
>   ntg-context@ntg.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://mailman.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
>   ntg-context-requ...@ntg.nl
> 
> You can reach the person managing the list at
>   ntg-context-ow...@ntg.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Manipulating the left blank page when chapter starts on
>  the right page (Wolfgang Schuster)
>   2. Re: Footnotes in float combinations missing in output
>  (Wolfgang Schuster)
>   3. Re: Manipulating the left blank page when chapter starts on
>  the right page (Jan U. Hasecke)
> 
> 
> --
> 
> Message: 1
> Date: Sun, 13 Jan 2019 16:56:40 +0100
> From: Wolfgang Schuster 
> To: mailing list for ConTeXt users , "Jan U.
>   Hasecke" 
> Subject: Re: [NTG-context] Manipulating the left blank page when
>   chapter starts on the right page
> Message-ID: 
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Jan U. Hasecke schrieb am 12.01.19 um 22:08:
>> Hi Aditya,
>> 
>> Am 12.01.19 um 20:11 schrieb Aditya Mahajan:
>>> On Sat, 12 Jan 2019, Jan U. Hasecke wrote:
>>> 
 Hi all,
 
 in my document \startchapter and \starttitle starts a new chapter on the
 right (odd) page. So sometimes, there is a blank even page just before a
 new chapter.
 
 I would like to manipulate this blank even page.
 
 There are several things I would like to do, eg. having no headers and
 footers, setting the background color to a named color, placing an image
 or some graphics on the page.
 
 Is there a way to define such a page, name it and call it in
 \startchapter so that it is placed on the left side.
>>> See https://tex.stackexchange.com/q/457428/323
>> Thanks a lot, but I wasn't looking for a way to just delete page numbers
>> but to style the empty page in arbitrary ways.
>> 
>> Maybe it is better to do this manually.
>> 
>> I would let chapter open on even pages too and just insert a styled page
>> by hand.
> 
> Here is a example which shows how you can change the background color
> of a empty page before the chapter title.
> 
> \setuppagenumbering
>   [alternative=doublesided]
> 
> \startsetups [chapter:before]
>   \doifoddpageelse
> {}
> {\pushbackground[page]
>  \setupbackgrounds[page][background=color,backgroundcolor=black]
>  \page[empty,right]
>  \popbackground}
> \stopsetups
> 
> \setuphead
>   [chapter]
>   [page=yes,
>before=\directsetup{chapter:before}]
> 
> \starttext
> 
> \startchapter[title={Knuth}]
> \dorecurse{10}{\samplefile{knuth}}
> \stopchapter
> 
> \startchapter[title={Zapf}]
> \dorecurse{10}{\samplefile{zapf}}
> \stopchapter
> 
> \startchapter[title={Ward}]
> \dorecurse{10}{\samplefile{ward}}
> \stopchapter
> 
> \stoptext
> 
> Wolfgang
> 
> 
> 
> --
> 
> Message: 2
> Date: Sun, 13 Jan 2019 21:06:42 +0100
> From: Wolfgang Schuster 
> To: mailing list for ConTeXt users , Lars
>   
> Subject: Re: [NTG-context] Footnotes in float combinations missing in
>   output
> Message-ID: 
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Lars schrieb am 09.01.19 um 23:01:
>> Hi there, hi Hans,
>> 
>> I just want to let you know that footnotes insterted in 
>> float-combinations don't get rendered properly, i. e. only the last 
>> footnote is placed in the output. MWE:
>> 
>> \starttext
>>   \startplacefigure[title={OuterCap\footnote{Outer footnote}}]
>> 
>> \startfloatcombination[nx=3]
>> \placefigure{Fnote1\footnote{Hello}}{\externalfigure[cow][width={.2\textwidth}]}
>> \placefigure{Fnote2\footnote{small}}{\externalfigure[cow][width={.2\textwidth}]}
>> \placefigure{Fnote3\footnote{world}}{\externalfigure[cow][width={.2\textwidth}]}
>> \stopfloatcombination
>> 
>>   \stopplacefigure
>> \stoptext
> 
> Not very nice but the following works.

Re: [NTG-context] Macro to write a vector with Metafun (again)

2018-12-04 Thread Hans Hagen

On 12/4/2018 4:38 PM, Fabrice Couvreur wrote:

Hello Hans,
The macro to draw a vector does not work even with the latest version of 
context standalone.

Thank you
Fabrice

\useMPlibrary[mat]

% will be in meta-imp-mat.mkiv
just watch in there .. we redid these stackers with more control (and 
they also live in their own instance now) ...


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
___

[NTG-context] Macro to write a vector with Metafun (again)

2018-12-04 Thread Fabrice Couvreur
Hello Hans,The macro to draw a vector does not work even with the
latest version of context standalone.
Thank you
Fabrice

\useMPlibrary[mat]

% will be in meta-imp-mat.mkiv

\startMPextensions
 vardef math_stacker_arrow_shape =
 image (
 drawarrow
 (OverlayWidth,OverlayOffset) -- (0,OverlayOffset)
 withcolor
 OverlayLineColor ;
 setbounds currentpicture to boundingbox currentpicture
bottomenlarged (OverlayOffset/2) topenlarged (OverlayOffset/2) ;
 )
 enddef ;
 vardef math_stacker_leftarrow_shape =
 math_stacker_arrow_shape
 enddef ;
 vardef math_stacker_rightarrow_shape =
 math_stacker_arrow_shape rotated 180
 enddef ;
\stopMPextensions

\startuniqueMPgraphic{math:stacker:\number"2190}
 math_stacker_draw(math_stacker_leftarrow_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"2192}
 math_stacker_draw(math_stacker_rightarrow_shape) ;
\stopuniqueMPgraphic

% so far

\setupmathstackers
   [both] % vfenced]
   [color=darkred,
alternative=mp]

\setupmathstackers
   [top]
   [color=darkred,
alternative=mp]

\setupmathstackers
   [bottom]
   [color=darkred,
alternative=mp]

\starttext

$\overbracket   {a+b+c+d} \quad \underbracket{a+b+c+d} \quad
\doublebracket{a+b+c+d}$ \blank
$\overparent{a+b+c+d} \quad \underparent {a+b+c+d} \quad
\doubleparent {a+b+c+d}$ \blank
$\overbrace {a+b+c+d} \quad \underbrace  {a+b+c+d} \quad
\doublebrace  {a+b+c+d}$ \blank
$\overbar   {a+b+c+d} \quad \underbar{a+b+c+d} \quad
\doublebar{a+b+c+d}$ \blank

$\overleftarrow  {a+b+c+d} \quad \overrightarrow  {a+b+c+d} $ \blank
$\underleftarrow {a+b+c+d} \quad \underrightarrow {a+b+c+d} $ \blank

\stoptext
___
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] Construct a matrix with Metafun

2018-10-14 Thread Wolfgang Schuster

It works for me when I add a space after each \MPcode{…} block.

\math{\MATRIX{\MPcode{...} ;\MPcode{...} }}

Wolfgang


Fabrice Couvreur schrieb am 14.10.18 um 12:18:

Hi Wolfgang,
Thank you for your solution.The space came from copy-paste because if 
I do this, it does not work :


\definemathmatrix [pmatrix][matrix:parentheses][simplecommand=MATRIX]

\starttext

\math{\MATRIX{\MPcode{draw (0,0) -- (1cm,0);} ;\MPcode{draw (0,0) -- 
(1cm,0);}}}


\stoptext

Fabrice

Le dim. 14 oct. 2018 à 11:08, Wolfgang Schuster 
<mailto:wolfgang.schuster.li...@gmail.com>> a écrit :




Fabrice Couvreur schrieb am 14.10.18 um 10:46:

Hi,
I tried to use Metafun and \definemathmatrix [pmatrix] [matrix:
parentheses] [simplecommand = MATRIX] to create two matrices, but
that does not work.


1. You have a space in [matrix: parentheses]

2. When you have only simple graphics like in your example you can
use framed.

\starttext

\startformula
  A\,
  \startmathmatrix[left=\left(,right=\right)]
  \NC \framed[width=1em,height=1em,frame=off,bottomframe=on]{} \NC
\framed[width=1em,height=1em,frame=off,bottomframe=on,leftframe=on]{}
\NR
  \NC \framed[width=1em,height=1em,frame=off,rightframe=on]{} \NC
\framed[width=1em,height=1em]{} \NR
  \stopmathmatrix
\stopformula

\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] Construct a matrix with Metafun

2018-10-14 Thread Wolfgang Schuster



Fabrice Couvreur schrieb am 14.10.18 um 10:46:

Hi,
I tried to use Metafun and \definemathmatrix [pmatrix] [matrix: 
parentheses] [simplecommand = MATRIX] to create two matrices, but that 
does not work.


1. You have a space in [matrix: parentheses]

2. When you have only simple graphics like in your example you can use 
framed.


\starttext

\startformula
  A\,
  \startmathmatrix[left=\left(,right=\right)]
  \NC \framed[width=1em,height=1em,frame=off,bottomframe=on]{} \NC 
\framed[width=1em,height=1em,frame=off,bottomframe=on,leftframe=on]{} \NR
  \NC \framed[width=1em,height=1em,frame=off,rightframe=on]{} \NC 
\framed[width=1em,height=1em]{} \NR

  \stopmathmatrix
\stopformula

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

[NTG-context] Construct a matrice with Metafun and \MATRIX{}

2018-10-14 Thread Fabrice Couvreur
Hi,
I tried to use Metafun and \definemathmatrix [pmatrix] [matrix:
parentheses] [simplecommand = MATRIX] to create two matrices, but that does
not work.
Thank you.

http://image.noelshack.com/fichiers/2018/41/7/1539507927-matrice.jpg
___
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] Construct a matrix with Metafun

2018-10-14 Thread Fabrice Couvreur
Hi,
I tried to use Metafun and \definemathmatrix [pmatrix] [matrix:
parentheses] [simplecommand = MATRIX] to create two matrices, but that does
not work.
Thank you.
Fabrice

[image: matrice.jpg]
___
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] Metafun scaling problem

2018-10-02 Thread Hans Hagen

On 10/2/2018 1:05 PM, Lutz Haseloff wrote:

xsized was the solution.
I wonder why xscaled worked for me for years.
because we used a 1bp image at that time (was needed in two-pass 
approach) ... we don't have that limitation now (and 1bp is pretty 
inaccurate anyway)


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
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread Lutz Haseloff
xsized was the solution.
I wonder why xscaled worked for me for years.

Thanks for the fast help.

Lutz

Am 2. Oktober 2018 11:10:04 MESZ schrieb Hans Hagen :
>On 10/2/2018 7:03 AM, Lutz Haseloff wrote:
>> Hi Hans, hi all,
>> 
>> I think, that recent context has a problem with scaling included pdf
>files.
>> My minimal file:
>> 
>> \startMPpage
>> draw externalfigure "cow.pdf" ;
>> \stopMPpage
>> 
>> The resulting pdf is, as the original, 97x70.6 mm, all ok.
>> 
>> If I try to scale to the original size, i get arithmetic overflow
>error.
>> 
>> \startMPpage
>> draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
>> \stopMPpage
>don't use xscaled, use xsized
>
>if you have
>
>path p ; p := fullcircls scaled 1cm ;
>
>and then do
>
>draw p xscaled 97pt ;
>
>you multiply with a number and only get 97pt width when your p has 1 bp
>
>width
>
>externalfigure has the original dimensions (so no width 1 bp here)
>
>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
___

Re: [NTG-context] Metafun scaling problem

2018-10-02 Thread luigi scarso
On Tue, Oct 2, 2018 at 7:03 AM Lutz Haseloff 
wrote:

> Hi Hans, hi all,
>
> I think, that recent context has a problem with scaling included pdf files.
>
>
>
Metapost traditional scaled math has a limited range, you can use doublefun
or decimalfun (not more binaryfun)

\starttext
\startTEXpage
\startMPcode{doublefun}
draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
\stopMPcode
\stopTEXpage
\stoptext

Page size:  13999.8 x 7410.6 pts



-- 
luigi
___
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] Metafun scaling problem

2018-10-02 Thread Hans Hagen

On 10/2/2018 7:03 AM, Lutz Haseloff wrote:

Hi Hans, hi all,

I think, that recent context has a problem with scaling included pdf files.
My minimal file:

\startMPpage
draw externalfigure "cow.pdf" ;
\stopMPpage

The resulting pdf is, as the original, 97x70.6 mm, all ok.

If I try to scale to the original size, i get arithmetic overflow error.

\startMPpage
draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
\stopMPpage

don't use xscaled, use xsized

if you have

path p ; p := fullcircls scaled 1cm ;

and then do

draw p xscaled 97pt ;

you multiply with a number and only get 97pt width when your p has 1 bp 
width


externalfigure has the original dimensions (so no width 1 bp here)

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
___

Re: [NTG-context] Metafun scaling problem

2018-10-01 Thread luigi scarso
On Tue, Oct 2, 2018 at 8:19 AM Lutz Haseloff 
wrote:

> On Windows, I got it working again with current Context (20180404) and
> current luatex from win32tex
> (1.07 development ID 6686)
>
> On linux-armhf I did a fresh "./first-setup.sh --engine=luatex" and got:
>
> mtx-context | ConTeXt Process Management 1.02
> mtx-context |
> mtx-context | main context file:
> /usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
> mtx-context | current version: 2018.09.30 19:32
>
> and:
>
> This is LuaTeX, Version 1.09.0 (TeX Live 2019/dev)
>
> The LuaTeX team is Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi
> Scarso.
>
> LuaTeX merges and builds upon (parts of) the code from these projects:
>
> tex : Donald Knuth
> etex : Peter Breitenlohner, Phil Taylor and friends
> omega : John Plaice and Yannis Haralambous
> aleph : Giuseppe Bilotta
> pdftex : Han The Thanh and friends
> kpathsea : Karl Berry, Olaf Weber and others
> lua : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo
> metapost : John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen and friends
> pplib : Paweł Jackowski
> fontforge : George Williams (partial)
> luajit : Mike Pall (used in LuajitTeX)
>
> Compiled with libpng 1.6.35; using 1.6.35
> Compiled with lua version 5.3.5
> Compiled with mplib version 2.00
> Compiled with zlib 1.2.11; using 1.2.11
>
> Development id: 6930
>
> No experimental, i think.
>
right, it's trunk.

-- 
luigi
___
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] Metafun scaling problem

2018-10-01 Thread Lutz Haseloff
On Windows, I got it working again with current Context (20180404) and current 
luatex from win32tex
(1.07 development ID 6686)

On linux-armhf I did a fresh "./first-setup.sh --engine=luatex" and got:

mtx-context | ConTeXt Process Management 1.02
mtx-context |
mtx-context | main context file: 
/usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2018.09.30 19:32

and:

This is LuaTeX, Version 1.09.0 (TeX Live 2019/dev)

The LuaTeX team is Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi Scarso.

LuaTeX merges and builds upon (parts of) the code from these projects:

tex   : Donald Knuth
etex  : Peter Breitenlohner, Phil Taylor and friends
omega : John Plaice and Yannis Haralambous
aleph : Giuseppe Bilotta
pdftex: Han The Thanh and friends
kpathsea  : Karl Berry, Olaf Weber and others
lua   : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de 
Figueiredo
metapost  : John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen and friends
pplib : Paweł Jackowski
fontforge : George Williams (partial)
luajit: Mike Pall (used in LuajitTeX)

Compiled with libpng 1.6.35; using 1.6.35
Compiled with lua version 5.3.5
Compiled with mplib version 2.00
Compiled with zlib 1.2.11; using 1.2.11

Development id: 6930

No experimental, i think.

Am 2. Oktober 2018 07:12:02 MESZ schrieb luigi scarso :
>On Tue, Oct 2, 2018 at 7:03 AM Lutz Haseloff
>
>wrote:
>
>> Hi Hans, hi all,
>>
>> I think, that recent context has a problem with scaling included pdf
>files.
>> My minimal file:
>>
>> \startMPpage
>> draw externalfigure "cow.pdf" ;
>> \stopMPpage
>>
>> The resulting pdf is, as the original, 97x70.6 mm, all ok.
>>
>> If I try to scale to the original size, i get arithmetic overflow
>error.
>>
>> \startMPpage
>> draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
>> \stopMPpage
>>
>>
>> Whe i scale it down, the pdf gets really big.
>>
>> \startMPpage
>> draw externalfigure "cow.pdf" xscaled 27.5mm yscaled 20mm ;
>> \stopMPpage
>>
>> results in a pdf with width of 4.938,8 mm and height of 2.612,3 mm.
>>
>> I tested with recent context and luatex under windows 64 and
>linux-armhf.
>>
>> which context and luatex version ?  Are you using experimental ?
>-- 
>luigi
___
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] Metafun scaling problem

2018-10-01 Thread luigi scarso
On Tue, Oct 2, 2018 at 7:03 AM Lutz Haseloff 
wrote:

> Hi Hans, hi all,
>
> I think, that recent context has a problem with scaling included pdf files.
> My minimal file:
>
> \startMPpage
> draw externalfigure "cow.pdf" ;
> \stopMPpage
>
> The resulting pdf is, as the original, 97x70.6 mm, all ok.
>
> If I try to scale to the original size, i get arithmetic overflow error.
>
> \startMPpage
> draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
> \stopMPpage
>
>
> Whe i scale it down, the pdf gets really big.
>
> \startMPpage
> draw externalfigure "cow.pdf" xscaled 27.5mm yscaled 20mm ;
> \stopMPpage
>
> results in a pdf with width of 4.938,8 mm and height of 2.612,3 mm.
>
> I tested with recent context and luatex under windows 64 and linux-armhf.
>
> which context and luatex version ?  Are you using experimental ?
-- 
luigi
___
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] Metafun scaling problem

2018-10-01 Thread Lutz Haseloff
Hi Hans, hi all,

I think, that recent context has a problem with scaling included pdf files.
My minimal file:

\startMPpage
draw externalfigure "cow.pdf" ;
\stopMPpage

The resulting pdf is, as the original, 97x70.6 mm, all ok.

If I try to scale to the original size, i get arithmetic overflow error.

\startMPpage
draw externalfigure "cow.pdf" xscaled 97mm yscaled 70.6mm ;
\stopMPpage


Whe i scale it down, the pdf gets really big.

\startMPpage
draw externalfigure "cow.pdf" xscaled 27.5mm yscaled 20mm ;
\stopMPpage

results in a pdf with width of 4.938,8 mm and height of 2.612,3 mm.

I tested with recent context and luatex under windows 64 and linux-armhf.

Greetings Lutz___
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] Metafun: Finding intersection between characters

2018-09-28 Thread Jeong Dal
Dear Hans,

Thank you so much for a new code which works fine.
It can be used for the title of chapters.
I will play with this to make a nice title.

Thank you again.

Best regards,

Dalyoung


> 2018. 9. 28. 오전 12:43, Hans Hagen  작성:
> 
> On 9/27/2018 5:06 PM, Jeong Dal wrote:
>> Dear Hans,
>> First, I appreciate for your concerning and sharing your valuable time on 
>> this matter.
>> I think that there is no one who has an interest in outlining Korean letters.
>> It is my self-interest to use outlined text for titles of chapters.
>> As we know, Korean letters are different from English letters. In one glyph, 
>> there are several parts, which makes the job difficult.
> 
> Here's some more to play with ...
> 
> \definefontfeature
> [korean-base]
> [mode=node,
>  script=hang,
>  language=kor]
> 
> \definefontfeature[outlined-10]
> [effect={effect=outline,width=0.10,auto=yes}]
> \definefontfeature[outlined-20]
> [effect={effect=outline,width=0.20,auto=yes}]
> \definefontfeature[outlined-30]
> [effect={effect=outline,width=0.30,auto=yes}]
> 
> \definefont[KoreanFontA][hanbatanglvt*korean-base @ 45pt]
> \definefont[KoreanFontB][hanbatanglvt*korean-base,boldened-10 @ 45pt]
> \definefont[KoreanFontC][hanbatanglvt*korean-base,boldened-20 @ 45pt]
> \definefont[KoreanFontD][hanbatanglvt*korean-base,boldened-30 @ 45pt]
> \definefont[KoreanFontE][hanbatanglvt*korean-base,outlined-10 @ 45pt]
> \definefont[KoreanFontF][hanbatanglvt*korean-base,outlined-20 @ 45pt]
> \definefont[KoreanFontG][hanbatanglvt*korean-base,outlined-30 @ 45pt]
> 
> \starttext
> 
>   \startlines
>   \KoreanFontA 랏논왕닭박서
>   \KoreanFontB 랏논왕닭박서
>   \KoreanFontC 랏논왕닭박서
>   \KoreanFontD 랏논왕닭박서
>   \KoreanFontE 랏논왕닭박서
>   \KoreanFontF 랏논왕닭박서
>   \KoreanFontG 랏논왕닭박서
>   \stoplines
> 
> \stoptext
> 
> This is probably easier to configure when you use titles.
> 
> 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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-27 Thread Hans Hagen

On 9/27/2018 5:06 PM, Jeong Dal wrote:

Dear Hans,

First, I appreciate for your concerning and sharing your valuable time on this 
matter.
I think that there is no one who has an interest in outlining Korean letters.
It is my self-interest to use outlined text for titles of chapters.

As we know, Korean letters are different from English letters. In one glyph, 
there are several parts, which makes the job difficult.


Here's some more to play with ...

\definefontfeature
  [korean-base]
  [mode=node,
   script=hang,
   language=kor]

\definefontfeature[outlined-10]
  [effect={effect=outline,width=0.10,auto=yes}]
\definefontfeature[outlined-20]
  [effect={effect=outline,width=0.20,auto=yes}]
\definefontfeature[outlined-30]
  [effect={effect=outline,width=0.30,auto=yes}]

\definefont[KoreanFontA][hanbatanglvt*korean-base @ 45pt]
\definefont[KoreanFontB][hanbatanglvt*korean-base,boldened-10 @ 45pt]
\definefont[KoreanFontC][hanbatanglvt*korean-base,boldened-20 @ 45pt]
\definefont[KoreanFontD][hanbatanglvt*korean-base,boldened-30 @ 45pt]
\definefont[KoreanFontE][hanbatanglvt*korean-base,outlined-10 @ 45pt]
\definefont[KoreanFontF][hanbatanglvt*korean-base,outlined-20 @ 45pt]
\definefont[KoreanFontG][hanbatanglvt*korean-base,outlined-30 @ 45pt]

\starttext

\startlines
\KoreanFontA 랏논왕닭박서
\KoreanFontB 랏논왕닭박서
\KoreanFontC 랏논왕닭박서
\KoreanFontD 랏논왕닭박서
\KoreanFontE 랏논왕닭박서
\KoreanFontF 랏논왕닭박서
\KoreanFontG 랏논왕닭박서
\stoplines

\stoptext

This is probably easier to configure when you use titles.

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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-27 Thread Jeong Dal
Dear Hans,

First, I appreciate for your concerning and sharing your valuable time on this 
matter.
I think that there is no one who has an interest in outlining Korean letters.
It is my self-interest to use outlined text for titles of chapters. 

As we know, Korean letters are different from English letters. In one glyph, 
there are several parts, which makes the job difficult.

Thank you so much.

Best regards,

Dalyoung




> 2018. 9. 27. 오후 5:49, Hans Hagen  작성:
> 
> On 9/26/2018 11:38 PM, Jeong Dal wrote:
>> Dear Hans,
>>> 2018. 9. 26. 오후 9:24, Hans Hagen >> > 작성:
>>> 
>>> On 9/26/2018 2:14 PM, Jeong Dal wrote:
 Dear Hans,
 I tested for more characters and found an interesting fact.
 If the first consonant and the vowels are connected in a glyph, then the 
 outlining works OK, otherwise, it makes outline of the first consonant 
 only.
>>> 
>>> you need to send a file not embedded .. otherwise the mail agent will apply 
>>> magic to korean
>>> 
>>> 
>> I didn’t think of it.
>> I attached a sample file.
> attached
> 
> 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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-27 Thread Hans Hagen

On 9/26/2018 11:38 PM, Jeong Dal wrote:

Dear Hans,

2018. 9. 26. 오후 9:24, Hans Hagen > 작성:


On 9/26/2018 2:14 PM, Jeong Dal wrote:

Dear Hans,
I tested for more characters and found an interesting fact.
If the first consonant and the vowels are connected in a glyph, then 
the outlining works OK, otherwise, it makes outline of the first 
consonant only.


you need to send a file not embedded .. otherwise the mail agent will 
apply magic to korean





I didn’t think of it.
I attached a sample file.

attached

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
-
\definefontfeature
  [korean-base]
  [goodies=hanbatanglvt,
   colorscheme=default,
   mode=node,
   script=hang,
   language=kor]

\definefont[KoreanFont][hanbatanglvt*korean-base]

\starttext

\startMPdefinitions
string KoreanColors[] ;

KoreanColors[1] := "darkred" ;
KoreanColors[2] := "darkgreen" ;
KoreanColors[3] := "darkblue" ;
KoreanColors[4] := "darkyellow" ;
KoreanColors[5] := "darkgray" ;

newinternal KoreanSplit ; KoreanSplit := -1 ;
newinternal KoreanCode  ; KoreanCode  := -2 ;
newinternal KoreanMode  ; KoreanMode  := KoreanSplit ;

def KoreanOutline(expr txt) =
picture p ; p := outlinetext.p(txt) ;
numeric n ; n := 0 ;
string old, new ; old := "" ;
for i within p :
if KoreanMode == KoreanSplit :
n := n + 1 ;
elseif KoreanMode == KoreanCode :
  new := prescriptpart i ;
  if new <> old :
  old := new ;
  n := n + 1 ;
  fi ;
else :
n := KoreanMode ;
fi ;
if unknown KoreanColors[n] :
n := 1 ;
fi ;
draw pathpart i
withpen pencircle scaled 1/10
withcolor KoreanColors[n] ;
endfor ;
enddef ;

def KoreanTest(expr txt) =
KoreanMode  := KoreanSplit ; KoreanOutline(txt) ;
currentpicture := currentpicture shifted (- xpart urcorner 
currentpicture, 0);
KoreanMode  := KoreanCode ; KoreanOutline(txt) ;
currentpicture := currentpicture shifted (- xpart urcorner 
currentpicture, 0);
KoreanMode  := 3 ; KoreanOutline(txt) ;
enddef ;

\stopMPdefinitions

% entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)

\startMPpage
KoreanTest("\KoreanFont 랏") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 랏") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 논") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 왕") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 닭") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 박") ;
\stopMPpage
\startMPpage
KoreanTest("\KoreanFont 서") ;
\stopMPpage

\stoptext
___
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] Metafun: Finding intersection between characters

2018-09-26 Thread Jeong Dal
Dear Hans,2018. 9. 26. 오후 9:24, Hans Hagen  작성:On 9/26/2018 2:14 PM, Jeong Dal wrote:Dear Hans,I tested for more characters and found an interesting fact.If the first consonant and the vowels are connected in a glyph, then the outlining works OK, otherwise, it makes outline of the first consonant only.you need to send a file not embedded .. otherwise the mail agent will apply magic to koreanI didn’t think of it.I attached a sample file.Thank you for your concern.Best regards,Dalyoung

outlineKorean.tex
Description: TeX document
___
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] Metafun: Finding intersection between characters

2018-09-26 Thread Hans Hagen

On 9/26/2018 2:14 PM, Jeong Dal wrote:

Dear Hans,

I tested for more characters and found an interesting fact.
If the first consonant and the vowels are connected in a glyph, then the 
outlining works OK, otherwise, it makes outline of the first consonant only.


you need to send a file not embedded .. otherwise the mail agent will 
apply magic to korean




Here is a MWE.

Thank you.
Best regards,

Dalyoung

%
\definefontfeature
  [korean-base]
  [goodies=hanbatanglvt,
   colorscheme=default,
   mode=node,
   script=hang,
   language=kor]

\definefont[KoreanFont][hanbatanglvt*korean-base]

\starttext

\startMPdefinitions
string KoreanColors[] ;

KoreanColors[1] := "darkred" ;
KoreanColors[2] := "darkgreen" ;
KoreanColors[3] := "darkblue" ;
KoreanColors[4] := "darkyellow" ;
KoreanColors[5] := "darkgray" ;

def KoreanOutline(expr txt) =
picture p ; p := outlinetext.p(txt) ;
numeric n ; n := 0 ;
string old, new ; old := "" ;
for i within p :
new := prescriptpart i ;
if (new = "") or (new <> old) :
old := new ;
n := n + 1 ;
if unknown KoreanColors[n] :
n := 1 ;
fi ;
fi ;
draw pathpart i
withpen pencircle scaled 1/10
withcolor KoreanColors[n] ;
endfor ;
enddef ;
\stopMPdefinitions
% entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)
\startMPpage
KoreanOutline("\KoreanFont 랏") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 논") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 왕") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 닭") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 박") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 서") ;
\stopMPpage

%


2018. 9. 26. 오후 7:10, Hans Hagen  작성:

On 9/26/2018 1:48 AM, Jeong Dal wrote:

Dear Hans,
First, it is great to know a new method of drawing an outlined font!
  I have applied it to Korean fonts. As you know, every Korean character is 
composed with “consonant+vowel(+consonant)” type. If consonant and vowel are 
connected (for example, “호”), then it draws correctly, otherwise (for example, 
“하”)  it draws only consonant.
Is there a way to count all the paths in a character(even if it is not 
connected)?

I assume that you want to identify the upto 3 snippets in a glyph so what you 
can do is loop over a picture.

\definefontfeature
  [korean-base]
  [goodies=hanbatanglvt,
   colorscheme=default,
   mode=node,
   script=hang,
   language=kor]

\definefont[KoreanFont][hanbatanglvt*korean-base]

\starttext

\startMPpage
string KoreanColors[] ;

KoreanColors[1] := "darkred" ;
KoreanColors[2] := "darkgreen" ;
KoreanColors[3] := "darkblue" ;
KoreanColors[4] := "darkyellow" ;
KoreanColors[5] := "darkgray" ;

def KoreanOutline(expr txt) =
picture p ; p := outlinetext.p(txt) ;
numeric n ; n := 0 ;
string old, new ; old := "" ;
for i within p :
new := prescriptpart i ;
if (new = "") or (new <> old) :
old := new ;
n := n + 1 ;
if unknown KoreanColors[n] :
n := 1 ;
fi ;
fi ;
draw pathpart i
withpen pencircle scaled 1/10
withcolor KoreanColors[n] ;
endfor ;
enddef ;

% entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)

KoreanOutline("\KoreanFont 랏") ;
\stopMPpage

\stoptext

The prescript will be set in a next beta so then you get better results for 
more complex shapes.

Loading the font takes a bit of time and memory because the first time the 
outlines are filtered and converted and saved. But I assume Koreans TeX users 
have fast computers with lots of memory.

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
-





--

-
  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.n

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-26 Thread Jeong Dal
Dear Hans,

I tested for more characters and found an interesting fact.
If the first consonant and the vowels are connected in a glyph, then the 
outlining works OK, otherwise, it makes outline of the first consonant only.

Here is a MWE.

Thank you.
Best regards,

Dalyoung

%
\definefontfeature
 [korean-base]
 [goodies=hanbatanglvt,
  colorscheme=default,
  mode=node,
  script=hang,
  language=kor]

\definefont[KoreanFont][hanbatanglvt*korean-base]

\starttext

\startMPdefinitions
   string KoreanColors[] ;

   KoreanColors[1] := "darkred" ;
   KoreanColors[2] := "darkgreen" ;
   KoreanColors[3] := "darkblue" ;
   KoreanColors[4] := "darkyellow" ;
   KoreanColors[5] := "darkgray" ;

   def KoreanOutline(expr txt) =
   picture p ; p := outlinetext.p(txt) ;
   numeric n ; n := 0 ;
   string old, new ; old := "" ;
   for i within p :
   new := prescriptpart i ;
   if (new = "") or (new <> old) :
   old := new ;
   n := n + 1 ;
   if unknown KoreanColors[n] :
   n := 1 ;
   fi ;
   fi ;
   draw pathpart i
   withpen pencircle scaled 1/10
   withcolor KoreanColors[n] ;
   endfor ;
   enddef ;
\stopMPdefinitions
   % entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)
\startMPpage
   KoreanOutline("\KoreanFont 랏") ;
\stopMPpage
\startMPpage
   KoreanOutline("\KoreanFont 논") ;
\stopMPpage
\startMPpage
   KoreanOutline("\KoreanFont 왕") ;
\stopMPpage
\startMPpage
   KoreanOutline("\KoreanFont 닭") ;
\stopMPpage
\startMPpage
   KoreanOutline("\KoreanFont 박") ;
\stopMPpage
\startMPpage
   KoreanOutline("\KoreanFont 서") ;
\stopMPpage

%

> 2018. 9. 26. 오후 7:10, Hans Hagen  작성:
> 
> On 9/26/2018 1:48 AM, Jeong Dal wrote:
>> Dear Hans,
>> First, it is great to know a new method of drawing an outlined font!
>>  I have applied it to Korean fonts. As you know, every Korean character is 
>> composed with “consonant+vowel(+consonant)” type. If consonant and vowel are 
>> connected (for example, “호”), then it draws correctly, otherwise (for 
>> example, “하”)  it draws only consonant.
>> Is there a way to count all the paths in a character(even if it is not 
>> connected)?
> I assume that you want to identify the upto 3 snippets in a glyph so what you 
> can do is loop over a picture.
> 
> \definefontfeature
>  [korean-base]
>  [goodies=hanbatanglvt,
>   colorscheme=default,
>   mode=node,
>   script=hang,
>   language=kor]
> 
> \definefont[KoreanFont][hanbatanglvt*korean-base]
> 
> \starttext
> 
> \startMPpage
>string KoreanColors[] ;
> 
>KoreanColors[1] := "darkred" ;
>KoreanColors[2] := "darkgreen" ;
>KoreanColors[3] := "darkblue" ;
>KoreanColors[4] := "darkyellow" ;
>KoreanColors[5] := "darkgray" ;
> 
>def KoreanOutline(expr txt) =
>picture p ; p := outlinetext.p(txt) ;
>numeric n ; n := 0 ;
>string old, new ; old := "" ;
>for i within p :
>new := prescriptpart i ;
>if (new = "") or (new <> old) :
>old := new ;
>n := n + 1 ;
>if unknown KoreanColors[n] :
>n := 1 ;
>fi ;
>fi ;
>draw pathpart i
>withpen pencircle scaled 1/10
>withcolor KoreanColors[n] ;
>endfor ;
>enddef ;
> 
>% entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)
> 
>KoreanOutline("\KoreanFont 랏") ;
> \stopMPpage
> 
> \stoptext
> 
> The prescript will be set in a next beta so then you get better results for 
> more complex shapes.
> 
> Loading the font takes a bit of time and memory because the first time the 
> outlines are filtered and converted and saved. But I assume Koreans TeX users 
> have fast computers with lots of memory.
> 
> 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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-26 Thread Jeong Dal
Dear Hans,

I have tested using your code. I just replace “N”, “T” with Korean letters.

Here is an MWE which is a simplified version of your code.
I tested using two fonts, and the outputs are different.

Thank you for your concern.

Best regards,

Dalyoung

%%%
\usetypescriptfile[type-hcrlvt]
\usetypescript[HcrFont] 
\setupbodyfont[Myface, rm, 12pt]
%\setupbodyfont[unfonts, rm, 12pt]

\startMPdefinitions
def filloutlinetext(expr o) =
draw image (
save n, m ; numeric n, m ; n := m := 0 ;
for i within o :
n := n + 1 ;
endfor ;
for i within o :
m := m + 1 ;
if n = m :
eofill
else :
nofill
fi pathpart i ;
endfor ;
)
enddef ;

def drawoutlinetext(expr o) =
draw image (
% nicer for properties
for i within o :
draw pathpart i ;
endfor ;
)
enddef ;

def outlinetexttopath(text o, p, n) =
scantokens("numeric " & str n &   ";") ;
scantokens("path "& str p & "[];") ;
n := 0 ;
for i within o : p[incr(n)] := pathpart i ; endfor ;
enddef ;

\stopMPdefinitions

\startbuffer[ho]
picture first  ; first  := outlinetext.p("호") ; first  := first scaled 
10 ;
filloutlinetext(first ) withcolor .5[blue,white] ;
drawoutlinetext(first ) ;
\stopbuffer
\startbuffer[ha]
picture first  ; first  := outlinetext.p("하") ; first  := first scaled 
10 ;
filloutlinetext(first ) withcolor .5[blue,white] ;
drawoutlinetext(first ) ;
\stopbuffer
\startbuffer[wang]
picture first  ; first  := outlinetext.p("왕") ; first  := first scaled 
10 ;
filloutlinetext(first ) withcolor .5[blue,white] ;
drawoutlinetext(first ) ;
\stopbuffer

\starttext

\processMPbuffer[ho]
\processMPbuffer[ha]
\processMPbuffer[wang]

\stoptext
%%%



type-hcrlvt.mkiv
Description: Binary data


___
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] Metafun: Finding intersection between characters

2018-09-26 Thread Hans Hagen

On 9/26/2018 1:48 AM, Jeong Dal wrote:

Dear Hans,

First, it is great to know a new method of drawing an outlined font!

  I have applied it to Korean fonts. As you know, every Korean character is 
composed with “consonant+vowel(+consonant)” type. If consonant and vowel are 
connected (for example, “호”), then it draws correctly, otherwise (for example, 
“하”)  it draws only consonant.
Is there a way to count all the paths in a character(even if it is not 
connected)?
I assume that you want to identify the upto 3 snippets in a glyph so 
what you can do is loop over a picture.


\definefontfeature
  [korean-base]
  [goodies=hanbatanglvt,
   colorscheme=default,
   mode=node,
   script=hang,
   language=kor]

\definefont[KoreanFont][hanbatanglvt*korean-base]

\starttext

\startMPpage
string KoreanColors[] ;

KoreanColors[1] := "darkred" ;
KoreanColors[2] := "darkgreen" ;
KoreanColors[3] := "darkblue" ;
KoreanColors[4] := "darkyellow" ;
KoreanColors[5] := "darkgray" ;

def KoreanOutline(expr txt) =
picture p ; p := outlinetext.p(txt) ;
numeric n ; n := 0 ;
string old, new ; old := "" ;
for i within p :
new := prescriptpart i ;
if (new = "") or (new <> old) :
old := new ;
n := n + 1 ;
if unknown KoreanColors[n] :
n := 1 ;
fi ;
fi ;
draw pathpart i
withpen pencircle scaled 1/10
withcolor KoreanColors[n] ;
endfor ;
enddef ;

% entered as three characters: ᄅ  ᅡ  ᆺ (mail collapses)

KoreanOutline("\KoreanFont 랏") ;
\stopMPpage

\stoptext

The prescript will be set in a next beta so then you get better results 
for more complex shapes.


Loading the font takes a bit of time and memory because the first time 
the outlines are filtered and converted and saved. But I assume Koreans 
TeX users have fast computers with lots of memory.


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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-26 Thread Hans Hagen

On 9/26/2018 1:48 AM, Jeong Dal wrote:

Dear Hans,

First, it is great to know a new method of drawing an outlined font!

  I have applied it to Korean fonts. As you know, every Korean character is 
composed with “consonant+vowel(+consonant)” type. If consonant and vowel are 
connected (for example, “호”), then it draws correctly, otherwise (for example, 
“하”)  it draws only consonant.
Is there a way to count all the paths in a character(even if it is not 
connected)?

mwe ...

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
___

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-25 Thread Jeong Dal
Dear Hans,

First, it is great to know a new method of drawing an outlined font!

 I have applied it to Korean fonts. As you know, every Korean character is 
composed with “consonant+vowel(+consonant)” type. If consonant and vowel are 
connected (for example, “호”), then it draws correctly, otherwise (for example, 
“하”)  it draws only consonant.
Is there a way to count all the paths in a character(even if it is not 
connected)?

Thank you.
Best regards,

Dalyoung


> 
> \starttext
> 
> \startMPdefinitions
> 
> % will be added to metafun:
> 
> def filloutlinetext(expr o) =
> draw image (
> save n, m ; numeric n, m ; n := m := 0 ;
> for i within o :
> n := n + 1 ;
> endfor ;
> for i within o :
> m := m + 1 ;
> if n = m :
> eofill
> else :
> nofill
> fi pathpart i ;
> endfor ;
> )
> enddef ;
> 

___
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] MetaFun: nofmultipars wrong?

2018-09-25 Thread Hans Hagen

On 9/25/2018 3:24 AM, Henri Menke wrote:

Dear list,

I used to be under the impression that when you wanted a background
frame around a piece of text, you'd use a loop over nofmultipars.
However, I realized that even when the contained material breaks across
pages, the counter remains 1 on the second page.

Another issue is that the frame containing the page break has a stray
blank line at the end.

Is this something that changed recently when switching to the one-pass
processing?  I have attached the output of beta 2018.09.24 14:11 (which
I believe is the latest).


label.lft(decimal multilocs[i], ulcorner multipars[i]) withcolor red ;



Cheers, Henri

---

\startuseMPgraphic{pageframe}
for i=1 upto nofmultipars :
 draw (ulcorner multipars[i] -- urcorner multipars[i]) withcolor red ;
 draw (llcorner multipars[i] -- lrcorner multipars[i]) withcolor red ;
 label.lft(decimal i, ulcorner multipars[i]) withcolor red ;
endfor ;
\stopuseMPgraphic

\definetextbackground
   [PageFrame]
   [mp=pageframe,
location=paragraph]

\starttext

\samplefile{knuth}

\starttextbackground[PageFrame]
\samplefile{knuth}
\stoptextbackground

\samplefile{knuth}

\starttextbackground[PageFrame]
\samplefile{knuth}
\samplefile{knuth}
\samplefile{knuth}
\stoptextbackground

\stoptext



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




--

-
  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] MetaFun: nofmultipars wrong?

2018-09-24 Thread Henri Menke
Dear list,

I used to be under the impression that when you wanted a background
frame around a piece of text, you'd use a loop over nofmultipars.
However, I realized that even when the contained material breaks across
pages, the counter remains 1 on the second page.

Another issue is that the frame containing the page break has a stray
blank line at the end.

Is this something that changed recently when switching to the one-pass
processing?  I have attached the output of beta 2018.09.24 14:11 (which
I believe is the latest).

Cheers, Henri

---

\startuseMPgraphic{pageframe}
for i=1 upto nofmultipars :
draw (ulcorner multipars[i] -- urcorner multipars[i]) withcolor red ;
draw (llcorner multipars[i] -- lrcorner multipars[i]) withcolor red ;
label.lft(decimal i, ulcorner multipars[i]) withcolor red ;
endfor ;
\stopuseMPgraphic

\definetextbackground
  [PageFrame]
  [mp=pageframe,
   location=paragraph]

\starttext

\samplefile{knuth}

\starttextbackground[PageFrame]
\samplefile{knuth}
\stoptextbackground

\samplefile{knuth}

\starttextbackground[PageFrame]
\samplefile{knuth}
\samplefile{knuth}
\samplefile{knuth}
\stoptextbackground

\stoptext


test.pdf
Description: Adobe PDF document
___
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] Metafun: Finding intersection between characters

2018-09-22 Thread Hans Hagen

On 9/22/2018 3:41 PM, Alan Braslau wrote:

On Sat, 22 Sep 2018 13:45:17 +0200
Hans Hagen  wrote:


On 9/22/2018 12:08 PM, Floris van Manen wrote:

It does not seem to work for all character combinations.
e.g. B&T works, C&T works, C&M works, but N&T does not work.
not N&M
Why would that be?
Thanks
.Floris





On 22 Sep 2018, at 11:27, Hans Hagen mailto:j.ha...@xs4all.nl>> wrote:

On 9/22/2018 10:35 AM, Henri Menke wrote:

Dear list,
Challanged by a very old TeX.SX question
https://tex.stackexchange.com/questions/180510
I wanted to calculate all the intersection points between two
characters.  Therefore I ripped off the \showshape macro to load the
outlines from the font and convert them to MetaPost paths.  Then I try
to find all intersections by cutting the path.
It somewhat works but for some reason, in the MWE below two intersection
points are missing.  I also have the feeling that my implementation is
extremely inefficient.  I would very much appreciate some hints by the
MetaPost experts!
Cheers, Henri
---
\startluacode
-- That's a simple reimplemetation of the showshape macro
function outlinepaths(character)
     local fontid      = font.current()
     local shapedata   = fonts.hashes.shapes[fontid] -- by index
     local chardata    = fonts.hashes.characters[fontid] -- by unicode
     local shapeglyphs = shapedata.glyphs or { }
     character = utf.byte(character)
     local c = chardata[character]
     if c then
         if not c.index then
             return {}
         end
         local glyph = shapeglyphs[c.index]
         if glyph and (glyph.segments or glyph.sequence) then
             local units  = shapedata.units or 1000
             local factor = 100/units
             local paths  = fonts.metapost.paths(glyph,factor)
             return paths
         end
     end
end
\stopluacode
\def\mpdefineoutlines#1#2{\ctxlua{
     local char = "\luaescapestring{#1}"
     local outlines = outlinepaths("#2")
     local len = \letterhash outlines
     tex.print("path " .. char .. "[];")
     tex.print(char .. "n := " .. len .. ";")
     for i, path in ipairs(outlines) do
         tex.print(char .. "[" .. i .. "] := " .. path .. ";")
     end
   }}
\starttext
\startMPpage
pair shift; shift := (1cm,-1cm);
numeric angle; angle := 5;
\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}
nofill B2;
nofill B3;
eofill B1 withcolor .5[blue,white];
fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];
path r;
numeric n; n := 0;
for i = 1 upto Bn:
     for j = 1 upto Tn:
         r := B[i];
         forever:
             pair q;
             r := r cutbefore (T[j] shifted (shift) rotated (angle));
             exitif length cuttings = 0;
             r := subpath(epsilon, length r) of r;
             q = point 0 of r;
             n := n + 1;
             dotlabel.urt(textext("\tfx" & decimal n), q);
         endfor;
     endfor ;
endfor ;
\stopMPpage
\stoptext


You migh find more when you go top double mode .. anyway, these
intersection calculations are not that accurate so you normally need
to apply some overkill.

- a bit cleaned up outlinepath function
- use document namespace
- add helper for defineoutline
- do 4 runs over the shapes (probably too many now)
- more neutral fill code

It makes a nice example for the metafun (although then I'd do it
slightly different). We need some rounding becaus eotherwise you get
similar points (you can add a message(q) someplace).

\startluacode

function document.outlinepaths(character)
    local chardata  = fonts.hashes.characters[true] -- by unicode
    local shapedata = fonts.hashes.shapes[true] -- by index
    local c         = chardata[character]
    if c and c.index and shapedata then
        local shapeglyphs = shapedata.glyphs or { }
        local glyph       = shapeglyphs[c.index]
        if glyph and (glyph.segments or glyph.sequence) then
            local units  = shapedata.units or 1000
            local factor = 100/units
            return fonts.metapost.paths(glyph,factor)
        end
    end
    return { }
end

function document.defineoutline(char,target)
    local outlines = document.outlinepaths(char)
    local nofpaths = #outlines
    context("path %s[] ;",target)
    context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
    for i=1,nofpaths do
        context("%s[%i] := %s ; ",target,i,outlines[i])
    end
end
\stopluacode

\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

\starttext

\startMPpage
pair shift ; shift := (1cm,-1cm);
numeric angle ; angle := 5;

\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}

for i=1 upto Bn - 1 : nofill B[i] ; endfor ;
eofill B[Bn] withcolor .5[blue,white] ;

for i=1 upto Tn :
    T[i] := T[i] shifted shift rotated angle ;
endfor ;

for i=1 upto Tn - 1 : nofill T[i] ; endfor ;
eofill T[

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-22 Thread Alan Braslau
On Sat, 22 Sep 2018 13:45:17 +0200
Hans Hagen  wrote:

> On 9/22/2018 12:08 PM, Floris van Manen wrote:
> > It does not seem to work for all character combinations.
> > e.g. B&T works, C&T works, C&M works, but N&T does not work.
> > not N&M
> > Why would that be?
> > Thanks
> > .Floris
> > 
> > 
> > 
> > 
> >> On 22 Sep 2018, at 11:27, Hans Hagen  >> <mailto:j.ha...@xs4all.nl>> wrote:
> >>
> >> On 9/22/2018 10:35 AM, Henri Menke wrote:
> >>> Dear list,
> >>> Challanged by a very old TeX.SX question
> >>> https://tex.stackexchange.com/questions/180510
> >>> I wanted to calculate all the intersection points between two
> >>> characters.  Therefore I ripped off the \showshape macro to load the
> >>> outlines from the font and convert them to MetaPost paths.  Then I try
> >>> to find all intersections by cutting the path.
> >>> It somewhat works but for some reason, in the MWE below two intersection
> >>> points are missing.  I also have the feeling that my implementation is
> >>> extremely inefficient.  I would very much appreciate some hints by the
> >>> MetaPost experts!
> >>> Cheers, Henri
> >>> ---
> >>> \startluacode
> >>> -- That's a simple reimplemetation of the showshape macro
> >>> function outlinepaths(character)
> >>>     local fontid      = font.current()
> >>>     local shapedata   = fonts.hashes.shapes[fontid] -- by index
> >>>     local chardata    = fonts.hashes.characters[fontid] -- by unicode
> >>>     local shapeglyphs = shapedata.glyphs or { }
> >>>     character = utf.byte(character)
> >>>     local c = chardata[character]
> >>>     if c then
> >>>         if not c.index then
> >>>             return {}
> >>>         end
> >>>         local glyph = shapeglyphs[c.index]
> >>>         if glyph and (glyph.segments or glyph.sequence) then
> >>>             local units  = shapedata.units or 1000
> >>>             local factor = 100/units
> >>>             local paths  = fonts.metapost.paths(glyph,factor)
> >>>             return paths
> >>>         end
> >>>     end
> >>> end
> >>> \stopluacode
> >>> \def\mpdefineoutlines#1#2{\ctxlua{
> >>>     local char = "\luaescapestring{#1}"
> >>>     local outlines = outlinepaths("#2")
> >>>     local len = \letterhash outlines
> >>>     tex.print("path " .. char .. "[];")
> >>>     tex.print(char .. "n := " .. len .. ";")
> >>>     for i, path in ipairs(outlines) do
> >>>         tex.print(char .. "[" .. i .. "] := " .. path .. ";")
> >>>     end
> >>>   }}
> >>> \starttext
> >>> \startMPpage
> >>> pair shift; shift := (1cm,-1cm);
> >>> numeric angle; angle := 5;
> >>> \mpdefineoutlines{B}{B}
> >>> \mpdefineoutlines{T}{T}
> >>> nofill B2;
> >>> nofill B3;
> >>> eofill B1 withcolor .5[blue,white];
> >>> fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];
> >>> path r;
> >>> numeric n; n := 0;
> >>> for i = 1 upto Bn:
> >>>     for j = 1 upto Tn:
> >>>         r := B[i];
> >>>         forever:
> >>>             pair q;
> >>>             r := r cutbefore (T[j] shifted (shift) rotated (angle));
> >>>             exitif length cuttings = 0;
> >>>             r := subpath(epsilon, length r) of r;
> >>>             q = point 0 of r;
> >>>             n := n + 1;
> >>>             dotlabel.urt(textext("\tfx" & decimal n), q);
> >>>         endfor;
> >>>     endfor ;
> >>> endfor ;
> >>> \stopMPpage
> >>> \stoptext
> >>
> >> You migh find more when you go top double mode .. anyway, these 
> >> intersection calculations are not that accurate so you normally need 
> >> to apply some overkill.
> >>
> >> - a bit cleaned up outlinepath function
> >> - use document namespace
> >> - add helper for defineoutline
> >> - do 4 runs over the shapes (probably too many now)
> >> - more neutral fill code
> >>
> >> It makes a nice example for 

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-22 Thread Hans Hagen

On 9/22/2018 12:08 PM, Floris van Manen wrote:

It does not seem to work for all character combinations.
e.g. B&T works, C&T works, C&M works, but N&T does not work.
not N&M
Why would that be?
Thanks
.Floris




On 22 Sep 2018, at 11:27, Hans Hagen <mailto:j.ha...@xs4all.nl>> wrote:


On 9/22/2018 10:35 AM, Henri Menke wrote:

Dear list,
Challanged by a very old TeX.SX question
https://tex.stackexchange.com/questions/180510
I wanted to calculate all the intersection points between two
characters.  Therefore I ripped off the \showshape macro to load the
outlines from the font and convert them to MetaPost paths.  Then I try
to find all intersections by cutting the path.
It somewhat works but for some reason, in the MWE below two intersection
points are missing.  I also have the feeling that my implementation is
extremely inefficient.  I would very much appreciate some hints by the
MetaPost experts!
Cheers, Henri
---
\startluacode
-- That's a simple reimplemetation of the showshape macro
function outlinepaths(character)
    local fontid      = font.current()
    local shapedata   = fonts.hashes.shapes[fontid] -- by index
    local chardata    = fonts.hashes.characters[fontid] -- by unicode
    local shapeglyphs = shapedata.glyphs or { }
    character = utf.byte(character)
    local c = chardata[character]
    if c then
        if not c.index then
            return {}
        end
        local glyph = shapeglyphs[c.index]
        if glyph and (glyph.segments or glyph.sequence) then
            local units  = shapedata.units or 1000
            local factor = 100/units
            local paths  = fonts.metapost.paths(glyph,factor)
            return paths
        end
    end
end
\stopluacode
\def\mpdefineoutlines#1#2{\ctxlua{
    local char = "\luaescapestring{#1}"
    local outlines = outlinepaths("#2")
    local len = \letterhash outlines
    tex.print("path " .. char .. "[];")
    tex.print(char .. "n := " .. len .. ";")
    for i, path in ipairs(outlines) do
        tex.print(char .. "[" .. i .. "] := " .. path .. ";")
    end
  }}
\starttext
\startMPpage
pair shift; shift := (1cm,-1cm);
numeric angle; angle := 5;
\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}
nofill B2;
nofill B3;
eofill B1 withcolor .5[blue,white];
fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];
path r;
numeric n; n := 0;
for i = 1 upto Bn:
    for j = 1 upto Tn:
        r := B[i];
        forever:
            pair q;
            r := r cutbefore (T[j] shifted (shift) rotated (angle));
            exitif length cuttings = 0;
            r := subpath(epsilon, length r) of r;
            q = point 0 of r;
            n := n + 1;
            dotlabel.urt(textext("\tfx" & decimal n), q);
        endfor;
    endfor ;
endfor ;
\stopMPpage
\stoptext


You migh find more when you go top double mode .. anyway, these 
intersection calculations are not that accurate so you normally need 
to apply some overkill.


- a bit cleaned up outlinepath function
- use document namespace
- add helper for defineoutline
- do 4 runs over the shapes (probably too many now)
- more neutral fill code

It makes a nice example for the metafun (although then I'd do it 
slightly different). We need some rounding becaus eotherwise you get 
similar points (you can add a message(q) someplace).


\startluacode

function document.outlinepaths(character)
   local chardata  = fonts.hashes.characters[true] -- by unicode
   local shapedata = fonts.hashes.shapes[true] -- by index
   local c         = chardata[character]
   if c and c.index and shapedata then
       local shapeglyphs = shapedata.glyphs or { }
       local glyph       = shapeglyphs[c.index]
       if glyph and (glyph.segments or glyph.sequence) then
           local units  = shapedata.units or 1000
           local factor = 100/units
           return fonts.metapost.paths(glyph,factor)
       end
   end
   return { }
end

function document.defineoutline(char,target)
   local outlines = document.outlinepaths(char)
   local nofpaths = #outlines
   context("path %s[] ;",target)
   context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
   for i=1,nofpaths do
       context("%s[%i] := %s ; ",target,i,outlines[i])
   end
end
\stopluacode

\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

\starttext

\startMPpage
pair shift ; shift := (1cm,-1cm);
numeric angle ; angle := 5;

\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}

for i=1 upto Bn - 1 : nofill B[i] ; endfor ;
eofill B[Bn] withcolor .5[blue,white] ;

for i=1 upto Tn :
   T[i] := T[i] shifted shift rotated angle ;
endfor ;

for i=1 upto Tn - 1 : nofill T[i] ; endfor ;
eofill T[Tn] withcolor .5[red,white] ;

pair found[] ;
boolean isnew ;
numeric n ; n := 0 ;
pair rq ;

def GoForIt(expr how) =
   path r ;
   for i = 1 upto Bn :
       

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-22 Thread Floris van Manen
It does not seem to work for all character combinations.
e.g. B&T works, C&T works, C&M works, but N&T does not work.
not N&M
Why would that be?
Thanks
.Floris





> On 22 Sep 2018, at 11:27, Hans Hagen  wrote:
> 
> On 9/22/2018 10:35 AM, Henri Menke wrote:
>> Dear list,
>> Challanged by a very old TeX.SX question
>> https://tex.stackexchange.com/questions/180510
>> I wanted to calculate all the intersection points between two
>> characters.  Therefore I ripped off the \showshape macro to load the
>> outlines from the font and convert them to MetaPost paths.  Then I try
>> to find all intersections by cutting the path.
>> It somewhat works but for some reason, in the MWE below two intersection
>> points are missing.  I also have the feeling that my implementation is
>> extremely inefficient.  I would very much appreciate some hints by the
>> MetaPost experts!
>> Cheers, Henri
>> ---
>> \startluacode
>> -- That's a simple reimplemetation of the showshape macro
>> function outlinepaths(character)
>> local fontid  = font.current()
>> local shapedata   = fonts.hashes.shapes[fontid] -- by index
>> local chardata= fonts.hashes.characters[fontid] -- by unicode
>> local shapeglyphs = shapedata.glyphs or { }
>> character = utf.byte(character)
>> local c = chardata[character]
>> if c then
>> if not c.index then
>> return {}
>> end
>> local glyph = shapeglyphs[c.index]
>> if glyph and (glyph.segments or glyph.sequence) then
>> local units  = shapedata.units or 1000
>> local factor = 100/units
>> local paths  = fonts.metapost.paths(glyph,factor)
>> return paths
>> end
>> end
>> end
>> \stopluacode
>> \def\mpdefineoutlines#1#2{\ctxlua{
>> local char = "\luaescapestring{#1}"
>> local outlines = outlinepaths("#2")
>> local len = \letterhash outlines
>> tex.print("path " .. char .. "[];")
>> tex.print(char .. "n := " .. len .. ";")
>> for i, path in ipairs(outlines) do
>> tex.print(char .. "[" .. i .. "] := " .. path .. ";")
>> end
>>   }}
>> \starttext
>> \startMPpage
>> pair shift; shift := (1cm,-1cm);
>> numeric angle; angle := 5;
>> \mpdefineoutlines{B}{B}
>> \mpdefineoutlines{T}{T}
>> nofill B2;
>> nofill B3;
>> eofill B1 withcolor .5[blue,white];
>> fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];
>> path r;
>> numeric n; n := 0;
>> for i = 1 upto Bn:
>> for j = 1 upto Tn:
>> r := B[i];
>> forever:
>> pair q;
>> r := r cutbefore (T[j] shifted (shift) rotated (angle));
>> exitif length cuttings = 0;
>> r := subpath(epsilon, length r) of r;
>> q = point 0 of r;
>> n := n + 1;
>> dotlabel.urt(textext("\tfx" & decimal n), q);
>> endfor;
>> endfor ;
>> endfor ;
>> \stopMPpage
>> \stoptext
> 
> You migh find more when you go top double mode .. anyway, these intersection 
> calculations are not that accurate so you normally need to apply some 
> overkill.
> 
> - a bit cleaned up outlinepath function
> - use document namespace
> - add helper for defineoutline
> - do 4 runs over the shapes (probably too many now)
> - more neutral fill code
> 
> It makes a nice example for the metafun (although then I'd do it slightly 
> different). We need some rounding becaus eotherwise you get similar points 
> (you can add a message(q) someplace).
> 
> \startluacode
> 
> function document.outlinepaths(character)
>local chardata  = fonts.hashes.characters[true] -- by unicode
>local shapedata = fonts.hashes.shapes[true] -- by index
>local c = chardata[character]
>if c and c.index and shapedata then
>local shapeglyphs = shapedata.glyphs or { }
>local glyph   = shapeglyphs[c.index]
>if glyph and (glyph.segments or glyph.sequence) then
>local units  = shapedata.units or 1000
>local factor = 100/units
>return fonts.metapost.paths(glyph,factor)
>end
>end
>return { }
> end
> 
> function document.defineoutline(char,target)
>local outlines = document.outlinepaths(char)
>local nofpaths = #outlines
>context("path %s[] ;",target)
> 

Re: [NTG-context] Metafun: Finding intersection between characters

2018-09-22 Thread Hans Hagen

On 9/22/2018 10:35 AM, Henri Menke wrote:

Dear list,

Challanged by a very old TeX.SX question
https://tex.stackexchange.com/questions/180510
I wanted to calculate all the intersection points between two
characters.  Therefore I ripped off the \showshape macro to load the
outlines from the font and convert them to MetaPost paths.  Then I try
to find all intersections by cutting the path.

It somewhat works but for some reason, in the MWE below two intersection
points are missing.  I also have the feeling that my implementation is
extremely inefficient.  I would very much appreciate some hints by the
MetaPost experts!

Cheers, Henri

---

\startluacode
-- That's a simple reimplemetation of the showshape macro
function outlinepaths(character)
 local fontid  = font.current()
 local shapedata   = fonts.hashes.shapes[fontid] -- by index
 local chardata= fonts.hashes.characters[fontid] -- by unicode
 local shapeglyphs = shapedata.glyphs or { }

 character = utf.byte(character)
 local c = chardata[character]
 if c then
 if not c.index then
 return {}
 end
 local glyph = shapeglyphs[c.index]
 if glyph and (glyph.segments or glyph.sequence) then
 local units  = shapedata.units or 1000
 local factor = 100/units
 local paths  = fonts.metapost.paths(glyph,factor)
 return paths
 end
 end
end
\stopluacode

\def\mpdefineoutlines#1#2{\ctxlua{
 local char = "\luaescapestring{#1}"
 local outlines = outlinepaths("#2")
 local len = \letterhash outlines
 tex.print("path " .. char .. "[];")
 tex.print(char .. "n := " .. len .. ";")
 for i, path in ipairs(outlines) do
 tex.print(char .. "[" .. i .. "] := " .. path .. ";")
 end
   }}

\starttext

\startMPpage
pair shift; shift := (1cm,-1cm);
numeric angle; angle := 5;

\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}

nofill B2;
nofill B3;
eofill B1 withcolor .5[blue,white];

fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];

path r;
numeric n; n := 0;
for i = 1 upto Bn:
 for j = 1 upto Tn:
 r := B[i];
 forever:
 pair q;
 r := r cutbefore (T[j] shifted (shift) rotated (angle));
 exitif length cuttings = 0;
 r := subpath(epsilon, length r) of r;
 q = point 0 of r;
 n := n + 1;
 dotlabel.urt(textext("\tfx" & decimal n), q);
 endfor;
 endfor ;
endfor ;
\stopMPpage

\stoptext


You migh find more when you go top double mode .. anyway, these 
intersection calculations are not that accurate so you normally need to 
apply some overkill.


- a bit cleaned up outlinepath function
- use document namespace
- add helper for defineoutline
- do 4 runs over the shapes (probably too many now)
- more neutral fill code

It makes a nice example for the metafun (although then I'd do it 
slightly different). We need some rounding becaus eotherwise you get 
similar points (you can add a message(q) someplace).


\startluacode

function document.outlinepaths(character)
local chardata  = fonts.hashes.characters[true] -- by unicode
local shapedata = fonts.hashes.shapes[true] -- by index
local c = chardata[character]
if c and c.index and shapedata then
local shapeglyphs = shapedata.glyphs or { }
local glyph   = shapeglyphs[c.index]
if glyph and (glyph.segments or glyph.sequence) then
local units  = shapedata.units or 1000
local factor = 100/units
return fonts.metapost.paths(glyph,factor)
end
end
return { }
end

function document.defineoutline(char,target)
local outlines = document.outlinepaths(char)
local nofpaths = #outlines
context("path %s[] ;",target)
context("numeric %sn ; %sn := %s ;",target,target,nofpaths)
for i=1,nofpaths do
context("%s[%i] := %s ; ",target,i,outlines[i])
end
end
\stopluacode

\def\mpdefineoutlines#1#2{\ctxlua{document.defineoutline(\number`#1,"#2")}}

\starttext

\startMPpage
pair shift ; shift := (1cm,-1cm);
numeric angle ; angle := 5;

\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}

for i=1 upto Bn - 1 : nofill B[i] ; endfor ;
eofill B[Bn] withcolor .5[blue,white] ;

for i=1 upto Tn :
T[i] := T[i] shifted shift rotated angle ;
endfor ;

for i=1 upto Tn - 1 : nofill T[i] ; endfor ;
eofill T[Tn] withcolor .5[red,white] ;

pair found[] ;
boolean isnew ;
numeric n ; n := 0 ;
pair rq ;

def GoForIt(expr how) =
path r ;
for i = 1 upto Bn :
for j = 1 upto Tn :
r := B[i] ;
forever:
pair q ;
if how = 1 :
r := r cutbefore T[j] ;
elseif how = 2 :
r := r cutbefore rev

[NTG-context] Metafun: Finding intersection between characters

2018-09-22 Thread Henri Menke
Dear list,

Challanged by a very old TeX.SX question
https://tex.stackexchange.com/questions/180510
I wanted to calculate all the intersection points between two
characters.  Therefore I ripped off the \showshape macro to load the
outlines from the font and convert them to MetaPost paths.  Then I try
to find all intersections by cutting the path.

It somewhat works but for some reason, in the MWE below two intersection
points are missing.  I also have the feeling that my implementation is
extremely inefficient.  I would very much appreciate some hints by the
MetaPost experts!

Cheers, Henri

---

\startluacode
-- That's a simple reimplemetation of the showshape macro
function outlinepaths(character)
local fontid  = font.current()
local shapedata   = fonts.hashes.shapes[fontid] -- by index
local chardata= fonts.hashes.characters[fontid] -- by unicode
local shapeglyphs = shapedata.glyphs or { }

character = utf.byte(character)
local c = chardata[character]
if c then
if not c.index then
return {}
end
local glyph = shapeglyphs[c.index]
if glyph and (glyph.segments or glyph.sequence) then
local units  = shapedata.units or 1000
local factor = 100/units
local paths  = fonts.metapost.paths(glyph,factor)
return paths
end
end
end
\stopluacode

\def\mpdefineoutlines#1#2{\ctxlua{
local char = "\luaescapestring{#1}"
local outlines = outlinepaths("#2")
local len = \letterhash outlines
tex.print("path " .. char .. "[];")
tex.print(char .. "n := " .. len .. ";")
for i, path in ipairs(outlines) do
tex.print(char .. "[" .. i .. "] := " .. path .. ";")
end
  }}

\starttext

\startMPpage
pair shift; shift := (1cm,-1cm);
numeric angle; angle := 5;

\mpdefineoutlines{B}{B}
\mpdefineoutlines{T}{T}

nofill B2;
nofill B3;
eofill B1 withcolor .5[blue,white];

fill T1 shifted (shift) rotated (angle) withcolor .5[red,white];

path r;
numeric n; n := 0;
for i = 1 upto Bn:
for j = 1 upto Tn:
r := B[i];
forever:
pair q;
r := r cutbefore (T[j] shifted (shift) rotated (angle));
exitif length cuttings = 0;
r := subpath(epsilon, length r) of r;
q = point 0 of r;
n := n + 1;
dotlabel.urt(textext("\tfx" & decimal n), q);
endfor;
endfor ;
endfor ;
\stopMPpage

\stoptext

___
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] MetaFun: How to draw bent paths?

2018-09-19 Thread Alan Braslau
On Wed, 19 Sep 2018 11:18:30 +1200
Henri Menke  wrote:

> On 18/09/18 21:23, Henri Menke wrote:
> > On 9/18/18 7:57 PM, Hans Hagen wrote:  
> >> On 9/16/2018 10:28 AM, Henri Menke wrote:  
> >>> Dear list,
> >>>
> >>> I want to draw paths between points which are bent by a certain angle.
> >>> The code in the MWE below works well but I was thinking that the expert
> >>> here can surely improve it and suggest a nicer syntax.  
> >> looks like a challenge for Alan ... isn't it also a bit 3d (2.5d)?  
> > 
> > I wasn't thinking about a 3D application here, just a little bend on the
> > path to go around other elements in my drawing without having to think
> > about explicit control points (like the second example in my original
> > post).  In the meantime I have improved the defintion of the macro to
> > avoid double computation of the angle:
> > 
> > vardef bend(expr a,b,phi) =
> > save x ;
> > x := angle(b-a) ;
> > a{dir(x+phi)} .. {dir(x-phi)}b
> > enddef ;
> > 
> > So currently the applied syntax is
> > 
> > drawarrow bend(z1, z2, 30) ;
> > 
> > However, I would prefer something like
> > 
> > drawarrow z1 bend(30) z2 ;
> > 
> > I'm not sure whether this is possible though.  Actually I'm reading the
> > MetaPost manual right know because my MP skills are rather poor.  
> 
> I think I got it now.  Not sure whether “bend” should be primary or
> something else.
> 
> \startMPdefinitions
> primarydef a bend phi =
> do_bend(a,phi)
> enddef ;
> 
> vardef do_bend(expr a, phi) expr b =
> save x ;
> x := angle(b-a) ;
> a{dir(x+phi)} .. {dir(x-phi)}b
> enddef ;
> \stopMPdefinitions
> 
> \starttext
> 
> \startMPpage
> z1 = (-.5cm,1cm) ;
> z2 = (1cm,3cm) ;
> 
> for phi = 0 step 5 until 360:
> draw z1 bend(phi) z2 withcolor (phi/360)[red,blue] ;
> endfor ;
> \stopMPpage
> 
> % Possible use case:
> 
> \startMPpage[offset=1cm]
> z1 = (-.5cm,1cm) ;
> z2 = (1cm,3cm) ;
> draw z1 -- z2 ;
> dotlabel.lft("$-$", z1) ;
> dotlabel.lft("$+$", z2) ;
> 
> path p; p := z1 bend(-30) z2 ;
> drawdblarrow p withcolor blue ;
> label.lrt(textext("$\Delta$"),point .5 along p)  withcolor blue ;
> \stopMPpage
> 
> \stoptext


Henri,

1. I added a sanity test (angle(origin) is undefined);
2. it is probably more efficient to calculate the angle twice than to allocate 
storage;
3. primary b;

4. then I created the variant arc (as in a bow) taking a delta (the tangent of
   an angle).

Alan


\startMPdefinitions
primarydef a bend phi =
do_bend(a,phi)
enddef ;

vardef do_bend(expr a, phi) primary b =
if abs(a-b)=0 :
a
else :
(a{dir(angle(b-a)+phi)} .. {dir(angle(b-a)-phi)}b)
fi
enddef ;

primarydef a arc delta =
do_arc(a,delta)
enddef ;

vardef do_arc(expr a,delta) primary b =
if abs(a-b)=0 :
a
else :
(a .. unitvector direction .5 of (a--b) rotated 90
 scaled delta * arclength (a--b)
 shifted .5[a,b]
   .. b)
fi
enddef ;
\stopMPdefinitions

\starttext

\startMPpage
z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;

for phi = 0 step 5 until 360:
draw z1 bend phi z2 withcolor (phi/360)[red,blue] ;
endfor ;
\stopMPpage

\startMPpage
z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;

for delta = -1 step .1 until 1:
draw z1 arc delta z2 withcolor ((delta+1)/2)[red,blue] ;
endfor ;
\stopMPpage

% Possible use case:

\startMPpage[offset=1cm]
z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;
draw z1 -- z2 ;
dotlabel.lft("$-$", z1) ;
dotlabel.lft("$+$", z2) ;

path p; p := z1 bend(-30) z2 ;
drawdblarrow p withcolor blue ;
label.lrt(textext("$\Delta$"),point .5 along p)  withcolor blue ;
\stopMPpage

\stoptext
___
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] MetaFun: How to draw bent paths?

2018-09-18 Thread Henri Menke


On 18/09/18 21:23, Henri Menke wrote:
> On 9/18/18 7:57 PM, Hans Hagen wrote:
>> On 9/16/2018 10:28 AM, Henri Menke wrote:
>>> Dear list,
>>>
>>> I want to draw paths between points which are bent by a certain angle.
>>> The code in the MWE below works well but I was thinking that the expert
>>> here can surely improve it and suggest a nicer syntax.
>> looks like a challenge for Alan ... isn't it also a bit 3d (2.5d)?
> 
> I wasn't thinking about a 3D application here, just a little bend on the
> path to go around other elements in my drawing without having to think
> about explicit control points (like the second example in my original
> post).  In the meantime I have improved the defintion of the macro to
> avoid double computation of the angle:
> 
> vardef bend(expr a,b,phi) =
> save x ;
> x := angle(b-a) ;
> a{dir(x+phi)} .. {dir(x-phi)}b
> enddef ;
> 
> So currently the applied syntax is
> 
> drawarrow bend(z1, z2, 30) ;
> 
> However, I would prefer something like
> 
> drawarrow z1 bend(30) z2 ;
> 
> I'm not sure whether this is possible though.  Actually I'm reading the
> MetaPost manual right know because my MP skills are rather poor.

I think I got it now.  Not sure whether “bend” should be primary or
something else.

\startMPdefinitions
primarydef a bend phi =
do_bend(a,phi)
enddef ;

vardef do_bend(expr a, phi) expr b =
save x ;
x := angle(b-a) ;
a{dir(x+phi)} .. {dir(x-phi)}b
enddef ;
\stopMPdefinitions

\starttext

\startMPpage
z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;

for phi = 0 step 5 until 360:
draw z1 bend(phi) z2 withcolor (phi/360)[red,blue] ;
endfor ;
\stopMPpage

% Possible use case:

\startMPpage[offset=1cm]
z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;
draw z1 -- z2 ;
dotlabel.lft("$-$", z1) ;
dotlabel.lft("$+$", z2) ;

path p; p := z1 bend(-30) z2 ;
drawdblarrow p withcolor blue ;
label.lrt(textext("$\Delta$"),point .5 along p)  withcolor blue ;
\stopMPpage

\stoptext


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

___
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] MetaFun: How to draw bent paths?

2018-09-18 Thread Henri Menke
On 9/18/18 7:57 PM, Hans Hagen wrote:
> On 9/16/2018 10:28 AM, Henri Menke wrote:
>> Dear list,
>>
>> I want to draw paths between points which are bent by a certain angle.
>> The code in the MWE below works well but I was thinking that the expert
>> here can surely improve it and suggest a nicer syntax.
> looks like a challenge for Alan ... isn't it also a bit 3d (2.5d)?

I wasn't thinking about a 3D application here, just a little bend on the
path to go around other elements in my drawing without having to think
about explicit control points (like the second example in my original
post).  In the meantime I have improved the defintion of the macro to
avoid double computation of the angle:

vardef bend(expr a,b,phi) =
save x ;
x := angle(b-a) ;
a{dir(x+phi)} .. {dir(x-phi)}b
enddef ;

So currently the applied syntax is

drawarrow bend(z1, z2, 30) ;

However, I would prefer something like

drawarrow z1 bend(30) z2 ;

I'm not sure whether this is possible though.  Actually I'm reading the
MetaPost manual right know because my MP skills are rather poor.

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

___
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] MetaFun: How to draw bent paths?

2018-09-18 Thread Hans Hagen

On 9/16/2018 10:28 AM, Henri Menke wrote:

Dear list,

I want to draw paths between points which are bent by a certain angle.
The code in the MWE below works well but I was thinking that the expert
here can surely improve it and suggest a nicer syntax.

looks like a challenge for Alan ... isn't it also a bit 3d (2.5d)?

-
  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] MetaFun: How to draw bent paths?

2018-09-16 Thread Henri Menke
Dear list,

I want to draw paths between points which are bent by a certain angle.
The code in the MWE below works well but I was thinking that the expert
here can surely improve it and suggest a nicer syntax.

Cheers, Henri

---

\startMPpage
vardef bend(expr a,b,phi) =
a{dir(angle(b-a)+phi)} .. {dir(angle(a-b)+180-phi)}b
enddef ;

z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;

for phi = 0 step 5 until 360:
draw bend(z1,z2,phi) withcolor (phi/360)[red,blue] ;
endfor ;
\stopMPpage

Possible use case:

\startMPpage[offset=1cm]
vardef bend(expr a,b,phi) =
a{dir(angle(b-a)+phi)} .. {dir(angle(a-b)+180-phi)}b
enddef ;

z1 = (-.5cm,1cm) ;
z2 = (1cm,3cm) ;
draw z1 -- z2 ;
dotlabel.lft("$-$", z1) ;
dotlabel.lft("$+$", z2) ;

path p; p := bend(z1,z2,-30) ;
drawdblarrow p withcolor blue ;
label.lrt(textext("$\Delta$"),point .5 along p)  withcolor blue ;
\stopMPpage

___
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] Draw an ink imprint with Metafun

2018-08-30 Thread Fabrice Couvreur
Hello,
The idea is to reproduce the ink mark of the figure below with Metafun
[image: IMG_0691.jpg]
Thank you
Fabrice
___
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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-18 Thread Fabrice Couvreur
Hello,
I just compiled the file with gvim and the expected result is the right one
; the problem is Emacs or my ~/.emacs file.
Fabrice

2018-07-17 23:00 GMT+02:00 Alan Braslau :

> \startusableMPgraphic ?
>
> > On 17 Jul 2018, at 14:46, Rik Kabel  wrote:
> >
> > On 7/17/2018 16:40, Hans Hagen wrote:
> >> On 7/17/2018 10:30 PM, Rik wrote:
> >>> On 7/16/2018 10:24, Fabrice Couvreur wrote:
>  % macros=mkvi
> 
>  \setuppagenumbering[location=footer]
> 
>  \startusableMPgraphic{NumberHead}
>   draw outlinetext.f
>   ("\bf\namedheadnumber{chapter}")
>   (withcolor "lightgray")
>   ysized 50pt ;
>  \stopusableMPgraphic
> 
> 
>  \unexpanded\def\processMPheadnumber#1%
>    {\useMPgraphic{NumberHead}}
> 
>  \setuphead
> [chapter]
> [command=\HeadTitle,
>  headstyle=\ss,
>  numbercommand=\processMPheadnumber]
> 
> 
>  \unexpanded\def\HeadTitle#1#2%
>    {\framed
>  [frame=off,
>  bottomframe=on,
>  width=broad,
>  align={broad,nothyphenated,left}]
>  {#1\blank[nowhite]#2}}
> 
>  \starttext
> 
>  \dorecurse{6}{\startchapter
>    [title={Fist chapter}]
>    \input knuth
>  \stopchapter}
> 
>  \stoptext
> >>>
> >>> Using TL18 on Win64 it produces a large chapter number on the right
> side above the chapter name -- I do not know what it should look like, so I
> won't say it works. It clearly fails with the 2018-07-13 beta, producing an
> odd graphic where the MP-generated digit should be:
> >>>
> >>> and fails in the same manner with the 2018-07-17 beta.
> >> define 'fails' ... a crash? can someone confirm it?
> > By failure, I meant that it produces the graphic I posted, a bold
> outline around a small square in the area in which the enlarged digit is
> expected. Not a crash.
> >
> > --
> > Rik
> >
> > 
> ___
> > 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
> 
> ___
>
___
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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Hans Hagen

On 7/17/2018 11:00 PM, Alan Braslau wrote:

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
  draw outlinetext.f
  ("\bf\namedheadnumber{chapter}")
  (withcolor "lightgray")
  ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
   {\useMPgraphic{NumberHead}}

\setuphead
[chapter]
[command=\HeadTitle,
 headstyle=\ss,
 numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
   {\framed
 [frame=off,
 bottomframe=on,
 width=broad,
 align={broad,nothyphenated,left}]
 {#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
   [title={Fist chapter}]
   \input knuth
\stopchapter}

\stoptext


i assume you wiped the cache

--

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

Re: [NTG-context] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Alan Braslau
\startusableMPgraphic ?

> On 17 Jul 2018, at 14:46, Rik Kabel  wrote:
> 
> On 7/17/2018 16:40, Hans Hagen wrote:
>> On 7/17/2018 10:30 PM, Rik wrote:
>>> On 7/16/2018 10:24, Fabrice Couvreur wrote:
 % macros=mkvi
 
 \setuppagenumbering[location=footer]
 
 \startusableMPgraphic{NumberHead}
  draw outlinetext.f
  ("\bf\namedheadnumber{chapter}")
  (withcolor "lightgray")
  ysized 50pt ;
 \stopusableMPgraphic
 
 
 \unexpanded\def\processMPheadnumber#1%
   {\useMPgraphic{NumberHead}}
 
 \setuphead
[chapter]
[command=\HeadTitle,
 headstyle=\ss,
 numbercommand=\processMPheadnumber]
 
 
 \unexpanded\def\HeadTitle#1#2%
   {\framed
 [frame=off,
 bottomframe=on,
 width=broad,
 align={broad,nothyphenated,left}]
 {#1\blank[nowhite]#2}}
 
 \starttext
 
 \dorecurse{6}{\startchapter
   [title={Fist chapter}]
   \input knuth
 \stopchapter}
 
 \stoptext
>>> 
>>> Using TL18 on Win64 it produces a large chapter number on the right side 
>>> above the chapter name -- I do not know what it should look like, so I 
>>> won't say it works. It clearly fails with the 2018-07-13 beta, producing an 
>>> odd graphic where the MP-generated digit should be:
>>> 
>>> and fails in the same manner with the 2018-07-17 beta.
>> define 'fails' ... a crash? can someone confirm it?
> By failure, I meant that it produces the graphic I posted, a bold outline 
> around a small square in the area in which the enlarged digit is expected. 
> Not a crash.
> 
> -- 
> Rik
> 
> ___
> 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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Rik Kabel

On 7/17/2018 16:40, Hans Hagen wrote:

On 7/17/2018 10:30 PM, Rik wrote:

On 7/16/2018 10:24, Fabrice Couvreur wrote:

% macros=mkvi

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
 draw outlinetext.f
 ("\bf\namedheadnumber{chapter}")
 (withcolor "lightgray")
 ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
  {\useMPgraphic{NumberHead}}

\setuphead
   [chapter]
   [command=\HeadTitle,
    headstyle=\ss,
    numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
  {\framed
    [frame=off,
    bottomframe=on,
    width=broad,
    align={broad,nothyphenated,left}]
    {#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
  [title={Fist chapter}]
  \input knuth
\stopchapter}

\stoptext


Using TL18 on Win64 it produces a large chapter number on the right 
side above the chapter name -- I do not know what it should look 
like, so I won't say it works. It clearly fails with the 2018-07-13 
beta, producing an odd graphic where the MP-generated digit should be:


and fails in the same manner with the 2018-07-17 beta.

define 'fails' ... a crash? can someone confirm it?
By failure, I meant that it produces the graphic I posted, a bold 
outline around a small square in the area in which the enlarged digit is 
expected. Not a crash.


--
Rik

___
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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Hans Hagen

On 7/17/2018 10:30 PM, Rik wrote:

On 7/16/2018 10:24, Fabrice Couvreur wrote:

% macros=mkvi

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
 draw outlinetext.f
 ("\bf\namedheadnumber{chapter}")
 (withcolor "lightgray")
 ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
  {\useMPgraphic{NumberHead}}

\setuphead
   [chapter]
   [command=\HeadTitle,
    headstyle=\ss,
    numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
  {\framed
    [frame=off,
    bottomframe=on,
    width=broad,
    align={broad,nothyphenated,left}]
    {#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
  [title={Fist chapter}]
  \input knuth
\stopchapter}

\stoptext


Using TL18 on Win64 it produces a large chapter number on the right side 
above the chapter name -- I do not know what it should look like, so I 
won't say it works. It clearly fails with the 2018-07-13 beta, producing 
an odd graphic where the MP-generated digit should be:


and fails in the same manner with the 2018-07-17 beta.

define 'fails' ... a crash? can someone confirm it?

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
___

Re: [NTG-context] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Fabrice Couvreur
Hi Pablo,
I do not have win64, sorry !
I installed texlive 2018 and the file compiles without problem but in a
console other than that of Emacs. I also get the expected result with the
latest version of context standalone but still in a console other than that
of Emacs. Should we conclude that the problem comes from Emacs ?
Fabrice

2018-07-17 21:03 GMT+02:00 Pablo Rodriguez :

> On 07/17/2018 12:36 PM, Fabrice Couvreur wrote:
> > Hi Hans,
> > In fact, the file compiles well with the beta version but only from a
> > terminal by running the
> > /home/aragorn/context/tex/texmf-linux-64/bin/context Test.tex && evince
> > Test.pdf command.
> > On the other hand, if I compile with Emacs, the chapter number does not
> > appear.
>
> Hi Fabrice,
>
> I’m on linux-64 and I don’t get the number in any way.
>
> I tried a clean install and I didn’t get the number.
>
> Have you tried with the latest beta for win64?
>
> 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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Rik

On 7/16/2018 10:24, Fabrice Couvreur wrote:

% macros=mkvi

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
 draw outlinetext.f
 ("\bf\namedheadnumber{chapter}")
 (withcolor "lightgray")
 ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
  {\useMPgraphic{NumberHead}}

\setuphead
   [chapter]
   [command=\HeadTitle,
    headstyle=\ss,
    numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
  {\framed
    [frame=off,
    bottomframe=on,
    width=broad,
    align={broad,nothyphenated,left}]
    {#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
  [title={Fist chapter}]
  \input knuth
\stopchapter}

\stoptext


Using TL18 on Win64 it produces a large chapter number on the right side 
above the chapter name -- I do not know what it should look like, so I 
won't say it works. It clearly fails with the 2018-07-13 beta, producing 
an odd graphic where the MP-generated digit should be:


and fails in the same manner with the 2018-07-17 beta.

--
Rik

___
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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Pablo Rodriguez
On 07/17/2018 12:36 PM, Fabrice Couvreur wrote:
> Hi Hans,
> In fact, the file compiles well with the beta version but only from a
> terminal by running the
> /home/aragorn/context/tex/texmf-linux-64/bin/context Test.tex && evince
> Test.pdf command.
> On the other hand, if I compile with Emacs, the chapter number does not
> appear.

Hi Fabrice,

I’m on linux-64 and I don’t get the number in any way.

I tried a clean install and I didn’t get the number.

Have you tried with the latest beta for win64?

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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Hans Hagen

On 7/17/2018 12:36 PM, Fabrice Couvreur wrote:

Hi Hans,
In fact, the file compiles well with the beta version but only from a 
terminal by running the 
/home/aragorn/context/tex/texmf-linux-64/bin/context Test.tex && evince 
Test.pdf command.
On the other hand, if I compile with Emacs, the chapter number does not 
appear.
I configured Emacs so that in context mode, the compilation is done with 
the beta version. Here is a part of my ~/.emacs file :


;; SERVER Download (MELPA):
(when (> = emacs-major-version 24)
(require 'package)
(Add-to-list
Archive-Package
'("melpa". "http://melpa.org/packages/";)
t)
(Package-initialize))

(setenv "PATH" "/home/aragorn/context/tex/texmf-linux-64/bin: $ PATH" t)

(setq ConTeXt-mode-hook
(lambda () (setq TeX-command-extra-options "--purgeall")))

I have no clue ... maybe a linux user knows or can confirm it.

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
___

Re: [NTG-context] Compilation problem with the latest version of standalone context(Metafun)

2018-07-17 Thread Fabrice Couvreur
Hi Hans,
In fact, the file compiles well with the beta version but only from a
terminal by running the
/home/aragorn/context/tex/texmf-linux-64/bin/context Test.tex && evince
Test.pdf command.
On the other hand, if I compile with Emacs, the chapter number does not
appear.
I configured Emacs so that in context mode, the compilation is done with
the beta version. Here is a part of my ~/.emacs file :

;; SERVER Download (MELPA):
(when (> = emacs-major-version 24)
   (require 'package)
   (Add-to-list
Archive-Package
'("melpa". "http://melpa.org/packages/";)
t)
   (Package-initialize))

(setenv "PATH" "/home/aragorn/context/tex/texmf-linux-64/bin: $ PATH" t)

(setq ConTeXt-mode-hook
   (lambda () (setq TeX-command-extra-options "--purgeall")))

Thank you
Fabrice


2018-07-16 19:42 GMT+02:00 Fabrice Couvreur :

> The chapter number does not appear. My editor is emacs and I compile with
> Context Full.
>
> 2018-07-16 19:27 GMT+02:00 Hans Hagen :
>
>> On 7/16/2018 4:24 PM, Fabrice Couvreur wrote:
>>
>>> Hello,
>>> The idea is to make a chapter header as with the "titlesec" package. My
>>> code compiles under texlive context 2018 but does not compile with last
>>> beta contest standalone.
>>>
>>
>> it processes on my machine so what fails?
>>
>> Thank you
>>> Fabrice
>>>
>>> 
>>>
>>> % macros=mkvi
>>>
>>> \setuppagenumbering[location=footer]
>>>
>>> \startusableMPgraphic{NumberHead}
>>>   draw outlinetext.f
>>>   ("\bf\namedheadnumber{chapter}")
>>>   (withcolor "lightgray")
>>>   ysized 50pt ;
>>> \stopusableMPgraphic
>>>
>>>
>>> \unexpanded\def\processMPheadnumber#1%
>>>{\useMPgraphic{NumberHead}}
>>>
>>> \setuphead
>>> [chapter]
>>> [command=\HeadTitle,
>>>  headstyle=\ss,
>>>  numbercommand=\processMPheadnumber]
>>>
>>>
>>> \unexpanded\def\HeadTitle#1#2%
>>>{\framed
>>>  [frame=off,
>>>  bottomframe=on,
>>>  width=broad,
>>>  align={broad,nothyphenated,left}]
>>>  {#1\blank[nowhite]#2}}
>>>
>>> \starttext
>>>
>>> \dorecurse{6}{\startchapter
>>>[title={Fist chapter}]
>>>\input knuth
>>> \stopchapter}
>>>
>>> \stoptext
>>>
>>> 
>>>
>>>
>>>
>>> 
>>> ___
>>> 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/list
>>> info/ntg-context
>>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki : http://contextgarden.net
>>> 
>>> ___
>>>
>>>
>>
>> --
>>
>> -
>>   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/list
>> info/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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-16 Thread Fabrice Couvreur
The chapter number does not appear. My editor is emacs and I compile with
Context Full.

2018-07-16 19:27 GMT+02:00 Hans Hagen :

> On 7/16/2018 4:24 PM, Fabrice Couvreur wrote:
>
>> Hello,
>> The idea is to make a chapter header as with the "titlesec" package. My
>> code compiles under texlive context 2018 but does not compile with last
>> beta contest standalone.
>>
>
> it processes on my machine so what fails?
>
> Thank you
>> Fabrice
>>
>> 
>>
>> % macros=mkvi
>>
>> \setuppagenumbering[location=footer]
>>
>> \startusableMPgraphic{NumberHead}
>>   draw outlinetext.f
>>   ("\bf\namedheadnumber{chapter}")
>>   (withcolor "lightgray")
>>   ysized 50pt ;
>> \stopusableMPgraphic
>>
>>
>> \unexpanded\def\processMPheadnumber#1%
>>{\useMPgraphic{NumberHead}}
>>
>> \setuphead
>> [chapter]
>> [command=\HeadTitle,
>>  headstyle=\ss,
>>  numbercommand=\processMPheadnumber]
>>
>>
>> \unexpanded\def\HeadTitle#1#2%
>>{\framed
>>  [frame=off,
>>  bottomframe=on,
>>  width=broad,
>>  align={broad,nothyphenated,left}]
>>  {#1\blank[nowhite]#2}}
>>
>> \starttext
>>
>> \dorecurse{6}{\startchapter
>>[title={Fist chapter}]
>>\input knuth
>> \stopchapter}
>>
>> \stoptext
>>
>> 
>>
>>
>>
>> 
>> ___
>> 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/list
>> info/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> 
>> ___
>>
>>
>
> --
>
> -
>   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/list
> info/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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-16 Thread Hans Hagen

On 7/16/2018 4:24 PM, Fabrice Couvreur wrote:

Hello,
The idea is to make a chapter header as with the "titlesec" package. My 
code compiles under texlive context 2018 but does not compile with last 
beta contest standalone.


it processes on my machine so what fails?


Thank you
Fabrice



% macros=mkvi

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
  draw outlinetext.f
  ("\bf\namedheadnumber{chapter}")
  (withcolor "lightgray")
  ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
   {\useMPgraphic{NumberHead}}

\setuphead
    [chapter]
    [command=\HeadTitle,
     headstyle=\ss,
     numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
   {\framed
     [frame=off,
     bottomframe=on,
     width=broad,
     align={broad,nothyphenated,left}]
     {#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
   [title={Fist chapter}]
   \input knuth
\stopchapter}

\stoptext





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




--

-
  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] Compilation problem with the latest version of standalone context(Metafun)

2018-07-16 Thread Fabrice Couvreur
Hello,
The idea is to make a chapter header as with the "titlesec" package. My
code compiles under texlive context 2018 but does not compile with last
beta contest standalone.
Thank you
Fabrice



% macros=mkvi

\setuppagenumbering[location=footer]

\startusableMPgraphic{NumberHead}
 draw outlinetext.f
 ("\bf\namedheadnumber{chapter}")
 (withcolor "lightgray")
 ysized 50pt ;
\stopusableMPgraphic


\unexpanded\def\processMPheadnumber#1%
  {\useMPgraphic{NumberHead}}

\setuphead
   [chapter]
   [command=\HeadTitle,
headstyle=\ss,
numbercommand=\processMPheadnumber]


\unexpanded\def\HeadTitle#1#2%
  {\framed
[frame=off,
bottomframe=on,
width=broad,
align={broad,nothyphenated,left}]
{#1\blank[nowhite]#2}}

\starttext

\dorecurse{6}{\startchapter
  [title={Fist chapter}]
  \input knuth
\stopchapter}

\stoptext


___
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] metafun: error when I call the same function twice consecutively.

2018-06-01 Thread Jeong Dal
Dear Alan,

Thank you for the clear explanation about z.
I tought that z is a special variable different from other pairs.
Now, I know that it is an equation.

Thank you again.

Best regards,

Dalyoung

> 2018. 6. 1. 오후 11:24, Alan Braslau  작성:
> 
> On Fri, 01 Jun 2018 20:29:41 +0900
> Jeong Dal  wrote:
> 
>> After inserting a line “save x, y;”, it works.
> 
> This is also defined as "clearxy ;"
> 
> For those learning MetaPost, simplifying, z is defined as "(x,y)" so
> one can write
>   z = (a,b) ;
> This is an EQUATION in MetaPost
>   (x,y) = (a,b) ;
> not an assignment (as in most other languages), actually a pair of
> equations:
>   x = a ; y = b ;
> When x and y are unknown, this can be "solved". When x and y contain
> values, it leads to "inconsistent equations".
> 
> One *cannot* write
>   z =: (a,b) ;
> ("=:" is the assignment operator),
> for z is just a macro, not a "pair" object or variable.
> 
> This can be *very* confusing when learning MetaPost.
> 
> Alan
> 
> P.S.
>   for i=0 upto n:
>   z[i] = (i,0) ;
>   endfor
> works as each element of the (pseudo)array z is unknown, at least the
> first time that it is used.

___
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] metafun: error when I call the same function twice consecutively.

2018-06-01 Thread Alan Braslau
On Fri, 01 Jun 2018 20:29:41 +0900
Jeong Dal  wrote:

> After inserting a line “save x, y;”, it works.

This is also defined as "clearxy ;"

For those learning MetaPost, simplifying, z is defined as "(x,y)" so
one can write
z = (a,b) ;
This is an EQUATION in MetaPost
(x,y) = (a,b) ;
not an assignment (as in most other languages), actually a pair of
equations:
x = a ; y = b ;
When x and y are unknown, this can be "solved". When x and y contain
values, it leads to "inconsistent equations".

One *cannot* write
z =: (a,b) ;
("=:" is the assignment operator),
for z is just a macro, not a "pair" object or variable.

This can be *very* confusing when learning MetaPost.

Alan

P.S.
for i=0 upto n:
z[i] = (i,0) ;
endfor
works as each element of the (pseudo)array z is unknown, at least the
first time that it is used.
___
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
___

<    1   2   3   4   5   6   7   8   9   10   >