ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A dumb question about MetaFun
@ 2020-08-16 17:06 Jairo A. del Rio
  2020-08-16 19:09 ` Keith McKay
  0 siblings, 1 reply; 4+ messages in thread
From: Jairo A. del Rio @ 2020-08-16 17:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi list! A simple question: is there an equivalent of thetextext for a
normal picture (an "image(draw ... ;)")? I want to move the center of a
picture to an specific point, like this:

\startMPpage

draw thetextext("\tttf hello", origin) ;
draw unitsquare scaled 1cm;

\stopMPpage

The "hello" is centered at the origin. I want to achieve the same result
for pictures. I've seen such a command some time ago, but I've forgotten
and I cannot find it again in documentation. Thanks and sorry for any
inconvenience.

Regards,

Jairo :)

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

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

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: A dumb question about MetaFun
  2020-08-16 17:06 A dumb question about MetaFun Jairo A. del Rio
@ 2020-08-16 19:09 ` Keith McKay
  2020-08-16 20:36   ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Keith McKay @ 2020-08-16 19:09 UTC (permalink / raw)
  To: ntg-context


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

Jairo

Try

draw unitsquare scaled 1cm shifted (xcm, ycm);

Page 11 of the manual metafun-p.pdf is your friend here. My recent 
conversation with Taco on this list will be usefull as well.

Best Wishes

Keith


On 16/08/2020 18:06, Jairo A. del Rio wrote:

> Hi list! A simple question: is there an equivalent of thetextext for a 
> normal picture (an "image(draw ... ;)")? I want to move the center of 
> a picture to an specific point, like this:
>
> \startMPpage
>
> draw thetextext("\tttf hello", origin) ;
> draw unitsquare scaled 1cm;
>
> \stopMPpage
>
> The "hello" is centered at the origin. I want to achieve the same 
> result for pictures. I've seen such a command some time ago, but I've 
> forgotten and I cannot find it again in documentation. Thanks and 
> sorry for any inconvenience.
>
> Regards,
>
> Jairo :)
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

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

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

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: A dumb question about MetaFun
  2020-08-16 19:09 ` Keith McKay
@ 2020-08-16 20:36   ` Taco Hoekwater
  2020-08-16 21:31     ` Jairo A. del Rio
  0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2020-08-16 20:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 16 Aug 2020, at 21:09, Keith McKay <mckaymeister@gmail.com> wrote:
> 
> Jairo
> 
> Try
> 
> draw unitsquare scaled 1cm shifted (xcm, ycm);
> 
> Page 11 of the manual metafun-p.pdf is your friend here. My recent conversation with Taco on this list will be usefull as well.

Also:

\starttext
\startMPpage
% puts the center of the bbox of path p at the point t
primarydef p centered t =
 hide(xshift := xpart t - (xpart urcorner p + xpart llcorner p)/2 ;
      yshift := ypart t - (ypart urcorner p + ypart llcorner p)/2 ; )
 p shifted (xshift,yshift)
enddef;

draw fullsquare scaled 2cm shifted (50,3) centered (100,100);

% just for reference:
drawdot origin withpen pencircle scaled 10 withcolor red;
drawdot (100,100) withpen pencircle scaled 10 withcolor green;
\stopMPpage
\stoptext

(I thought there was a metafun definition for that but I cannot find it).

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: A dumb question about MetaFun
  2020-08-16 20:36   ` Taco Hoekwater
@ 2020-08-16 21:31     ` Jairo A. del Rio
  0 siblings, 0 replies; 4+ messages in thread
From: Jairo A. del Rio @ 2020-08-16 21:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I found another workaround, but I'm going to try this. Thank you, Keith,
and thank you, Taco.

Cordially,

Jairo :)

El dom., 16 de ago. de 2020 3:36 p. m., Taco Hoekwater <taco@elvenkind.com>
escribió:

>
>
> > On 16 Aug 2020, at 21:09, Keith McKay <mckaymeister@gmail.com> wrote:
> >
> > Jairo
> >
> > Try
> >
> > draw unitsquare scaled 1cm shifted (xcm, ycm);
> >
> > Page 11 of the manual metafun-p.pdf is your friend here. My recent
> conversation with Taco on this list will be usefull as well.
>
> Also:
>
> \starttext
> \startMPpage
> % puts the center of the bbox of path p at the point t
> primarydef p centered t =
>  hide(xshift := xpart t - (xpart urcorner p + xpart llcorner p)/2 ;
>       yshift := ypart t - (ypart urcorner p + ypart llcorner p)/2 ; )
>  p shifted (xshift,yshift)
> enddef;
>
> draw fullsquare scaled 2cm shifted (50,3) centered (100,100);
>
> % just for reference:
> drawdot origin withpen pencircle scaled 10 withcolor red;
> drawdot (100,100) withpen pencircle scaled 10 withcolor green;
> \stopMPpage
> \stoptext
>
> (I thought there was a metafun definition for that but I cannot find it).
>
> Best wishes,
> Taco
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

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

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

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2020-08-16 21:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 17:06 A dumb question about MetaFun Jairo A. del Rio
2020-08-16 19:09 ` Keith McKay
2020-08-16 20:36   ` Taco Hoekwater
2020-08-16 21:31     ` Jairo A. del Rio

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