Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-17 Thread Nicola
In article 
calbomsadxdyx8q9pmva2_cpm3rq8j1mxkepqgnasjtafuhc...@mail.gmail.com,
 Mojca Miklavec mojca.miklavec.li...@gmail.com wrote:

 Dear Hans,
 
 I have problems with externalfigure inside metapost.
 
 In MKII, only
 externalfigure something.png;
 works, while in MKIV only
 draw externalfigure something.png;
 is accepted.
 
 Is there any chance to accept one of the syntaxes in both flavours?
 
 Thank you,
Mojca
 
 Minimal example:
 
 \starttext
 \startMPpage
 % only good for MKII
 externalfigure abc.png xyscaled (5cm,8cm);
 % only good for MKIV
 % draw externalfigure abc.png xyscaled (5cm,8cm);
 \stopMPpage
 \stoptext

Does the following workaround work for you?

def mydraw text t =
   def f = begingroup t endgroup enddef;
   if picture f : draw f ; fi
enddef;
mydraw externalfigure abc.png xyscaled (5cm,8cm);

Nicola

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-17 Thread Nicola
In article nvitacolonna-9462e1.4817092...@news.gmane.org,
 Nicola nvitacolo...@gmail.com wrote:
 
 Does the following workaround work for you?
 
 def mydraw text t =
def f = begingroup t endgroup enddef;
if picture f : draw f ; fi
 enddef;
 mydraw externalfigure abc.png xyscaled (5cm,8cm);

This may be better:

def mydraw text t =  _mydraw begingroup t endgroup enddef;
def _mydraw primary f = if picture f : draw f ; fi enddef;
mydraw externalfigure abc.png xyscaled (5cm,8cm);

Nicola

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-17 Thread Mojca Miklavec
On Sat, Sep 17, 2011 at 11:11, Nicola wrote:

 Does the following workaround work for you?

If Hans is willing to fix metafun, I would prefer to avoid workarounds.
(I don't care which syntax is used, but I would be grateful if the
same syntax worked in both mkii and mkiv.)

Since you seem to be a metapost expert: do you have any idea what
exactly would have to be fixed in ConTeXt core code?

If ConTeXt won't be fixed for whatever reason, I will write a wrapper
function using your code, but I would like to avoid that.

Hans?

Mojca
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-17 Thread Hans Hagen

On 17-9-2011 11:32, Mojca Miklavec wrote:


Hans?


is in too busy mode currently .. more later (but the metafun mkiv way 
is conceptually more ok so we might need to change metafun mkii)


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-17 Thread Nicola
In article 
calbomsbm2thsup+kzjlkfd8pba2bbt7jvf-bvrwkrkz3+wb...@mail.gmail.com,
 Mojca Miklavec mojca.miklavec.li...@gmail.com wrote:

 do you have any idea what
 exactly would have to be fixed in ConTeXt core code?

Edit mp-spec.mp and change the line

  draw p withcolor ...

with

  image(draw p withcolor ...)

The line is in the body of the doexternalfigure macro. Then, 'draw 
externalfigure ...' should work in mkii, too.

Note: knowledge of ConTeXt internals - which I don't have - is needed to be 
sure 
that the patch doesn't break anything. Hence, the above is to be considered as 
a 
wild guess of mine.

Nicola

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-16 Thread Mojca Miklavec
Dear Hans,

I have problems with externalfigure inside metapost.

In MKII, only
externalfigure something.png;
works, while in MKIV only
draw externalfigure something.png;
is accepted.

Is there any chance to accept one of the syntaxes in both flavours?

Thank you,
   Mojca

Minimal example:

\starttext
\startMPpage
% only good for MKII
externalfigure abc.png xyscaled (5cm,8cm);
% only good for MKIV
% draw externalfigure abc.png xyscaled (5cm,8cm);
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] externalfigure vs. draw externalfigure in metafun

2011-09-16 Thread Andreas Schneider

On 16.09.2011 16:00, Mojca Miklavec wrote:

Dear Hans,

I have problems with externalfigure inside metapost.

In MKII, only
 externalfigure something.png;
works, while in MKIV only
 draw externalfigure something.png;
is accepted.

Is there any chance to accept one of the syntaxes in both flavours?


Hmm, I noticed that too. However I'm sure that plain externalfigure 
used to work in MkIV too, so I guess the change happened (more or less) 
recently.



--
Best Regards,
Andreas
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___