ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Font for MetaPost graphics
@ 2012-05-03  0:08 Marco
  2012-05-03  0:22 ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-03  0:08 UTC (permalink / raw)
  To: ntg-context

The wiki claims setting up an MPenvironment is enough to change the
font in MetaPost graphics:

\startMPenvironment%[global]
	\switchtobodyfont [sans]
\stopMPenvironment

\starttext
	This should be serif.

	\startMPcode
		draw textext("This should be in sans.");
	\stopMPcode
\stoptext

However, this has no effect. All text is in default serif font. If
[global] is provided, all text is in sans font. I am aware of a
similar issue in a thread last year¹, but the solution didn't really
address the problem. textext("\sans This should be sans.") works
here, but the point is that the MPenvironment fails. Why is that?

Marco

[1] http://thread.gmane.org/gmane.comp.tex.context/69044


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

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

* Re: Font for MetaPost graphics
  2012-05-03  0:08 Font for MetaPost graphics Marco
@ 2012-05-03  0:22 ` Aditya Mahajan
  2012-05-03  1:13   ` Marco
  0 siblings, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2012-05-03  0:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1016 bytes --]

On Thu, 3 May 2012, Marco wrote:

> The wiki claims setting up an MPenvironment is enough to change the
> font in MetaPost graphics:
>
> \startMPenvironment%[global]
> 	\switchtobodyfont [sans]
> \stopMPenvironment
>
> \starttext
> 	This should be serif.
>
> 	\startMPcode
> 		draw textext("This should be in sans.");
> 	\stopMPcode
> \stoptext
>
> However, this has no effect. All text is in default serif font. If
> [global] is provided, all text is in sans font. I am aware of a
> similar issue in a thread last year¹, but the solution didn't really
> address the problem. textext("\sans This should be sans.") works
> here, but the point is that the MPenvironment fails. Why is that?

Metapost now runs as a library. All the text is first typeset by ConTeXt 
and metapost only knows the bounding box of the labels.

You can try (untested):

\starttext

This is serif

\switchtobodyfont[sans]
\startMPcode
draw textext("This should be sans");
\stopMPcode

\stoptext

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Font for MetaPost graphics
  2012-05-03  0:22 ` Aditya Mahajan
@ 2012-05-03  1:13   ` Marco
  2012-05-04  7:10     ` Mojca Miklavec
  0 siblings, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-03  1:13 UTC (permalink / raw)
  To: ntg-context

On 2012-05-02 Aditya Mahajan <adityam@umich.edu> wrote:

> Metapost now runs as a library. All the text is first typeset by ConTeXt 
> and metapost only knows the bounding box of the labels.
> 
> You can try (untested):
> 
> \starttext
> 
> This is serif
> 
> \switchtobodyfont[sans]
> \startMPcode
> draw textext("This should be sans");
> \stopMPcode
> 
> \stoptext

This works, of course. However it continues with sans font even
after \stopMPcode. This is better (but clumsy):

\start
\switchtobodyfont[sans]
\startMPcode
draw textext("This should be sans");
\stopMPcode
\stop
Here serif again.

The text in Metapost adapts to the text set in ConTeXt. But the font
setup should *only* be set for MetaPost, not regular text.

Does that mean, that MPenvironment is deprecated and does not work
at all?

Marco


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


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

* Re: Font for MetaPost graphics
  2012-05-03  1:13   ` Marco
@ 2012-05-04  7:10     ` Mojca Miklavec
  2012-05-04  7:13       ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Mojca Miklavec @ 2012-05-04  7:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, May 3, 2012 at 3:13 AM, Marco wrote:
>
> The text in Metapost adapts to the text set in ConTeXt. But the font
> setup should *only* be set for MetaPost, not regular text.
>
> Does that mean, that MPenvironment is deprecated and does not work
> at all?

Please don't rely on my answer since I haven't been following the
development as closely as I used to in past.

But my guess is that the argument goes into the opposite way. I past
(and still in MKII) one *had to* set up fonts twice - once for the
main document and once for MetaPost since MetaPost did its own
processing of labels and MetaPost didn't see the ConTeXt font setups.
So it was "difficult" to convince MetaPost to use the same font.

Now (as Aditya explained) metapost automatically inherits font setups
from the main document and it might be that nobody ever thought of /
requested / needed to have a special setup for using different font
for MetaPost labels.

I can think of many workarounds to this, but I agree that there is a
valid reason why
    \startMPenvironment
(or some other command) should be able to change the font inside
metapost labels only.

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
___________________________________________________________________________________


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

* Re: Font for MetaPost graphics
  2012-05-04  7:10     ` Mojca Miklavec
@ 2012-05-04  7:13       ` Aditya Mahajan
  2012-05-04 11:09         ` Marco
  2012-05-05 11:24         ` Hans Hagen
  0 siblings, 2 replies; 17+ messages in thread
From: Aditya Mahajan @ 2012-05-04  7:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 4 May 2012, Mojca Miklavec wrote:

> I can think of many workarounds to this, but I agree that there is a
> valid reason why
>    \startMPenvironment
> (or some other command) should be able to change the font inside
> metapost labels only.

A better alternative would to define

\setupMPtext
    [
     style=...,
     color=...,
     setups=...,
    ]

that can be used to set the style for metapost text.

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


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

* Re: Font for MetaPost graphics
  2012-05-04  7:13       ` Aditya Mahajan
@ 2012-05-04 11:09         ` Marco
  2012-05-05 10:26           ` Hans Hagen
  2012-05-05 11:24         ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-04 11:09 UTC (permalink / raw)
  To: ntg-context

On 2012-05-04 Aditya Mahajan <adityam@umich.edu> wrote:

> On Fri, 4 May 2012, Mojca Miklavec wrote:

> > But my guess is that the  argument goes into the opposite way. I
> > past (and still in MKII) one *had  to* set up fonts twice - once
> > for the main  document and once for MetaPost  since MetaPost did
> > its own processing of labels and MetaPost didn't see the ConTeXt
> > font setups. So  it was "difficult" to convince  MetaPost to use
> > the same font.

I agree, it's  a big step forward towards  usability and consistency
to have  MetaPost automatically inherit ConTeXts  settings. However,
it went out-of-control now.

> A better alternative would to define
> 
> \setupMPtext
>     [
>      style=...,
>      color=...,
>      setups=...,
>     ]
> 
> that can be used to set the style for metapost text.

+1

Marco


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


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

* Re: Font for MetaPost graphics
  2012-05-04 11:09         ` Marco
@ 2012-05-05 10:26           ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2012-05-05 10:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 4-5-2012 13:09, Marco wrote:
> On 2012-05-04 Aditya Mahajan<adityam@umich.edu>  wrote:
>
>> On Fri, 4 May 2012, Mojca Miklavec wrote:
>
>>> But my guess is that the  argument goes into the opposite way. I
>>> past (and still in MKII) one *had  to* set up fonts twice - once
>>> for the main  document and once for MetaPost  since MetaPost did
>>> its own processing of labels and MetaPost didn't see the ConTeXt
>>> font setups. So  it was "difficult" to convince  MetaPost to use
>>> the same font.
>
> I agree, it's  a big step forward towards  usability and consistency
> to have  MetaPost automatically inherit ConTeXts  settings. However,
> it went out-of-control now.

well, you still get text and not something random, so out-of-control is 
a bit too strong

anyhow, we can do

\newconditional\MPLIBtextgetdone

\def\MPLIBsettext#1% #2%
   {\ifconditional\MPLIBtextgetdone
    \else
      \cldcontext{metapost.tex.get()}%
      \settrue\MPLIBtextgetdone % no \global needed
    \fi
    \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}

\def\MPLIBresettexts
   {\ctxlua{metapost.resettextexts()}%$
    \setfalse\MPLIBtextgetdone}

\starttext

Serif

\startMPcode
     draw textext("\ss Sans") ;
\stopMPcode

Serif

\startMPenvironment
     \ss
\stopMPenvironment

\startMPcode
     draw textext("Sans") ;
\stopMPcode

Serif

\stoptext


>> A better alternative would to define
>>
>> \setupMPtext
>>      [
>>       style=...,
>>       color=...,
>>       setups=...,
>>      ]
>>
>> that can be used to set the style for metapost text.

this is ok for me, but then we mighe as well drop \startMPenviroment 
(and someone has to wikify that then)

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
___________________________________________________________________________________


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

* Re: Font for MetaPost graphics
  2012-05-04  7:13       ` Aditya Mahajan
  2012-05-04 11:09         ` Marco
@ 2012-05-05 11:24         ` Hans Hagen
  2012-05-05 14:07           ` Marco
  2012-05-08 17:01           ` Marco
  1 sibling, 2 replies; 17+ messages in thread
From: Hans Hagen @ 2012-05-05 11:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4-5-2012 09:13, Aditya Mahajan wrote:
> On Fri, 4 May 2012, Mojca Miklavec wrote:
>
>> I can think of many workarounds to this, but I agree that there is a
>> valid reason why
>> \startMPenvironment
>> (or some other command) should be able to change the font inside
>> metapost labels only.
>
> A better alternative would to define
>
> \setupMPtext
> [
> style=...,
> color=...,
> setups=...,
> ]
>
> that can be used to set the style for metapost text.

As we already have instances, I've extended that mechanism, so one can say:

\startsetups mp:instance:one
     indeed:\space
\stopsetups

\setupMPinstance
   [metafun]
   [textstyle=bold,
    textcolor=darkgreen,
    setups=mp:instance:one]

\defineMPinstance
   [mympinstance]
   [metafun]
   [textcolor=red]

\starttext

     \startMPcode
         draw textext("some text") ;
     \stopMPcode

     \startMPcode{mympinstance}
         draw textext("some text") ;
     \stopMPcode

\stoptext

 > +1
 >
 > Marco

So .. we know who is going to wikify this ...

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
___________________________________________________________________________________


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

* Re: Font for MetaPost graphics
  2012-05-05 11:24         ` Hans Hagen
@ 2012-05-05 14:07           ` Marco
  2012-05-05 16:03             ` Aditya Mahajan
  2012-05-08 17:01           ` Marco
  1 sibling, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-05 14:07 UTC (permalink / raw)
  To: ntg-context

On 2012-05-05 Hans Hagen <pragma@wxs.nl> wrote:

That means, MPenvironment will be dropped, right? But what is the
new interface, \setupMPtext or MPinstance?

>  > +1
>  >
>  > Marco
> 
> So .. we know who is going to wikify this ...

You're welcome :)

Marco


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


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

* Re: Font for MetaPost graphics
  2012-05-05 14:07           ` Marco
@ 2012-05-05 16:03             ` Aditya Mahajan
  0 siblings, 0 replies; 17+ messages in thread
From: Aditya Mahajan @ 2012-05-05 16:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 5 May 2012, Marco wrote:

> On 2012-05-05 Hans Hagen <pragma@wxs.nl> wrote:
>
> That means, MPenvironment will be dropped, right? But what is the
> new interface, \setupMPtext or MPinstance?

\setupMPinstance

The advantage is that you can have multiple instances in parallel.

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


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

* Re: Font for MetaPost graphics
  2012-05-05 11:24         ` Hans Hagen
  2012-05-05 14:07           ` Marco
@ 2012-05-08 17:01           ` Marco
  2012-05-08 17:08             ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-08 17:01 UTC (permalink / raw)
  To: ntg-context

On 2012-05-05 Hans Hagen <pragma@wxs.nl> wrote:

This code fails:

\defineMPinstance [mympinstance] [metafun] [textcolor=red]

\starttext

\startMPcode
	draw textext("some text") ;
\stopMPcode

\startMPcode{mympinstance}
	draw textext("some text") ;
\stopMPcode

\stoptext

Marco


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


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

* Re: Font for MetaPost graphics
  2012-05-08 17:01           ` Marco
@ 2012-05-08 17:08             ` Hans Hagen
  2012-05-08 17:19               ` Marco
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2012-05-08 17:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 8-5-2012 19:01, Marco wrote:
> On 2012-05-05 Hans Hagen<pragma@wxs.nl>  wrote:

Did I?

> This code fails:
>
> \defineMPinstance [mympinstance] [metafun] [textcolor=red]
>
> \starttext
>
> \startMPcode
> 	draw textext("some text") ;
> \stopMPcode
>
> \startMPcode{mympinstance}
> 	draw textext("some text") ;
> \stopMPcode
>
> \stoptext
>
> Marco

It works here.

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
___________________________________________________________________________________


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

* Re: Font for MetaPost graphics
  2012-05-08 17:08             ` Hans Hagen
@ 2012-05-08 17:19               ` Marco
  2012-05-08 17:34                 ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-08 17:19 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

On 2012-05-08 Hans Hagen <pragma@wxs.nl> wrote:

> On 8-5-2012 19:01, Marco wrote:
> > On 2012-05-05 Hans Hagen<pragma@wxs.nl>  wrote:
> 
> Did I?

My bad ;)

> > This code fails:
> >
> > \defineMPinstance [mympinstance] [metafun] [textcolor=red]
> >
> > \starttext
> >
> > \startMPcode
> > 	draw textext("some text") ;
> > \stopMPcode
> >
> > \startMPcode{mympinstance}
> > 	draw textext("some text") ;
> > \stopMPcode
> >
> > \stoptext
> >
> > Marco
> 
> It works here.

Fails here, source and log are attached.

current version: 2012.05.08 13:45

Marco

[-- Attachment #2: g.tex --]
[-- Type: text/x-tex, Size: 206 bytes --]

\defineMPinstance [mympinstance] [metafun] [textcolor=red]

\starttext

\startMPcode
	draw textext("some text") ;
\stopMPcode

\startMPcode{mympinstance}
	draw textext("some text") ;
\stopMPcode

\stoptext

[-- Attachment #3: g.log --]
[-- Type: text/x-log, Size: 16286 bytes --]

(g.tex

ConTeXt  ver: 2012.05.08 13:45 MKIV  fmt: 2012.5.8  int: english/english

system          > cont-new.mkiv loaded
(/home/zewz/context/tex/texmf-context/tex/context/base/cont-new.mkiv
system          > beware: some patches loaded from cont-new.mkiv
)
system          > g.top loaded

system          > options > start used options

used options    > % runtime options files (command line driven)
used options    > \unprotect
used options    > % feedback and basic job control
used options    > % handy for special styles
used options    > \startluacode
used options    > document = document or { }
used options    > document.arguments={
used options    >  ["once"]=true,
used options    > }
used options    > document.files={
used options    >  "g",
used options    > }
used options    > \stopluacode
used options    > % process info
used options    > \setupsystem[inputfile=g]
used options    > \setupsystem[\c!n=3,\c!m=1]
used options    > \enabledirectives[system.runonce]
used options    > % modes
used options    > % options (not that important)
used options    > \startsetups *runtime:options
used options    > \stopsetups
used options    > % styles and modules
used options    > \startsetups *runtime:modules
used options    > \stopsetups
used options    > % done
used options    > \protect \endinput

system          > options > stop used options

(g.top)
fonts           > latin modern fonts are not preloaded
languages       > language en is active
{/home/zewz/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown: library 'loc'
{/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map}
fonts           > virtual math > unable to resolve name mapsfromchar
fonts           > fallback modern rm 12pt is loaded
metapost        > initializing instance 'metafun' using format 'metafun'
metapost        > loading 'metafun': /home/zewz/context/tex/texmf-context/metapost/context/base/metafun.mpiv
metapost        > initializing instance 'mympinstance' using format 'metafun'
metapost        > loading 'metafun': /home/zewz/context/tex/texmf-context/metapost/context/base/metafun.mpiv
! terminal: >> OverlayLineColor
>> (0,0,0)
! Equation cannot be performed (numeric=color).
<to be read again> 
                   ;
<*> ...ineWidth:=0pt  ; OverlayLineColor:=(0,0,0);
                                                   OverlayColor:=(0,0,0); Ba...

>> OverlayColor
>> (0,0,0)
! Equation cannot be performed (numeric=color).
<to be read again> 
                   ;
<*> ...yLineColor:=(0,0,0); OverlayColor:=(0,0,0);
                                                   BaseLineSkip:=14.4816pt; ...


.

system          > tex > error on line 11 in file g.tex: terminal: >> OverlayLineColor
>> (0,0,0)
! Equation cannot be performed (numeric=color).
<to be read again> 
                   ;
<*> ...ineWidth:=0pt  ; OverlayLineColor:=(0,0,0);
                                                   OverlayColor:=(0,0,0); Ba...

>> OverlayColor
>> (0,0,0)
! Equation cannot be performed (numeric=color).
<to be read again> 
                   ;
<*> ...yLineColor:=(0,0,0); OverlayColor:=(0,0,0);
                                                   BaseLineSkip:=14.4816pt; ...


 ...

 1     \defineMPinstance [mympinstance] [metafun] [textcolor=red]
 2     
 3     \starttext
 4     
 5     \startMPcode
 6     	draw textext("some text") ;
 7     \stopMPcode
 8     
 9     \startMPcode{mympinstance}
10     	draw textext("some text") ;
11 >>  \stopMPcode
12     
13     \stoptext
14     

<inserted text> ...0;;]===], [===[;;]===], false)}
                                                  
\meta_process_graphic ...!!es , \MPaskedfigure )}}
                                                  \egroup \placeMPgraphic \m...
\meta_start_code_instance ..._process_graphic {#2}
                                                  \meta_end_graphic_group 
l.11 \stopMPcode
                
? x

system          > files > start used files

used files      >    1: filename=g | filetype=tex | foundname=g.tex | usedmethod=filesystem
used files      >    2: filename=cont-new.mkiv | filetype=tex | foundname=/home/zewz/context/tex/texmf-context/tex/context/base/cont-new.mkiv | usedmethod=database
used files      >    3: filename=g.top | foundname=g.top | usedmethod=direct
used files      >    4: filename=lang-us.lua | filetype=lua | foundname=/home/zewz/context/tex/texmf-context/tex/context/patterns/lang-us.lua | usedmethod=database
used files      >    5: filename=mkiv-base.map | filetype=map | format=map | foundname=/home/zewz/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map | usedmethod=database
used files      >    6: filename=lm.lfg | filetype=tex | foundname=/home/zewz/context/tex/texmf-context/tex/context/fonts/lm.lfg | usedmethod=database
used files      >    7: filename=lm-math.lfg | filetype=tex | foundname=/home/zewz/context/tex/texmf-context/tex/context/fonts/lm-math.lfg | usedmethod=database
used files      >    8: filename=lm-math.map | filetype=map | format=map | foundname=/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-math.map | usedmethod=database
used files      >    9: filename=lm-rm.map | filetype=map | format=map | foundname=/home/zewz/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map | usedmethod=database
used files      >   10: filename=lmroman12-regular | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf | usedmethod=database
used files      >   11: filename=lmroman7-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman7-regular.otf | usedmethod=database
used files      >   12: filename=rm-lmr7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/rm-lmr7.tfm | usedmethod=database
used files      >   13: filename=lmmi7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmmi7.tfm | usedmethod=database
used files      >   14: filename=lmsy7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmsy7.tfm | usedmethod=database
used files      >   15: filename=lmex10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmex10.tfm | usedmethod=database
used files      >   16: filename=msam7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/symbols/msam7.tfm | usedmethod=database
used files      >   17: filename=msbm7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/symbols/msbm7.tfm | usedmethod=database
used files      >   18: filename=stmary10.afm | filetype=afm | format=afm | foundname=/home/zewz/context/tex/texmf/fonts/afm/public/stmaryrd/stmary10.afm | usedmethod=database
used files      >   19: filename=stmary10.pfb | filetype=pfb | format=pfb | foundname=/home/zewz/context/tex/texmf/fonts/type1/public/stmaryrd/stmary10.pfb | usedmethod=database
used files      >   20: filename=lmroman7-bold.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman7-bold.otf | usedmethod=database
used files      >   21: filename=lmmib7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmmib7.tfm | usedmethod=database
used files      >   22: filename=lmsans8-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmsans8-regular.otf | usedmethod=database
used files      >   23: filename=lmmono8-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmmono8-regular.otf | usedmethod=database
used files      >   24: filename=eufm7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/euler/eufm7.tfm | usedmethod=database
used files      >   25: filename=eufb7.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/euler/eufb7.tfm | usedmethod=database
used files      >   26: filename=lmroman9-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman9-regular.otf | usedmethod=database
used files      >   27: filename=rm-lmr9.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/rm-lmr9.tfm | usedmethod=database
used files      >   28: filename=lmmi9.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmmi9.tfm | usedmethod=database
used files      >   29: filename=lmsy9.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmsy9.tfm | usedmethod=database
used files      >   30: filename=msam10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/symbols/msam10.tfm | usedmethod=database
used files      >   31: filename=msbm10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/symbols/msbm10.tfm | usedmethod=database
used files      >   32: filename=lmroman9-bold.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman9-bold.otf | usedmethod=database
used files      >   33: filename=lmmib10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmmib10.tfm | usedmethod=database
used files      >   34: filename=lmsans9-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmsans9-regular.otf | usedmethod=database
used files      >   35: filename=lmmono9-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmmono9-regular.otf | usedmethod=database
used files      >   36: filename=eufm10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/euler/eufm10.tfm | usedmethod=database
used files      >   37: filename=eufb10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/amsfonts/euler/eufb10.tfm | usedmethod=database
used files      >   38: filename=lmroman12-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf | usedmethod=database
used files      >   39: filename=rm-lmr12.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/rm-lmr12.tfm | usedmethod=database
used files      >   40: filename=lmmi12.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmmi12.tfm | usedmethod=database
used files      >   41: filename=lmsy10.tfm | filetype=tfm | format=tfm | foundname=/home/zewz/context/tex/texmf/fonts/tfm/public/lm/lmsy10.tfm | usedmethod=database
used files      >   42: filename=lmroman12-bold.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmroman12-bold.otf | usedmethod=database
used files      >   43: filename=lmsans12-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmsans12-regular.otf | usedmethod=database
used files      >   44: filename=lmmono12-regular.otf | filetype=otf | format=otf | foundname=/home/zewz/context/tex/texmf/fonts/opentype/public/lm/lmmono12-regular.otf | usedmethod=database
used files      >   45: filename=metafun.mpiv | filetype=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/metafun.mpiv | usedmethod=database
used files      >   46: filename=mp-base.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-base.mpiv | usedmethod=database
used files      >   47: filename=mp-tool.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-tool.mpiv | usedmethod=database
used files      >   48: filename=mp-mlib.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-mlib.mpiv | usedmethod=database
used files      >   49: filename=mp-page.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-page.mpiv | usedmethod=database
used files      >   50: filename=mp-butt.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-butt.mpiv | usedmethod=database
used files      >   51: filename=mp-shap.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-shap.mpiv | usedmethod=database
used files      >   52: filename=mp-grph.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-grph.mpiv | usedmethod=database
used files      >   53: filename=mp-grid.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-grid.mpiv | usedmethod=database
used files      >   54: filename=mp-form.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-form.mpiv | usedmethod=database
used files      >   55: filename=mp-figs.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-figs.mpiv | usedmethod=database
used files      >   56: filename=mp-func.mpiv | filetype=mp | format=mp | foundname=/home/zewz/context/tex/texmf-context/metapost/context/base/mp-func.mpiv | usedmethod=database

system          > files > stop used files


system          > structure > start used structure

used structure  > text: g

system          > structure > stop used structure

mkiv lua stats  > used config file          - selfautoparent:texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path           - /home/zewz/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606
mkiv lua stats  > resource resolver         - loadtime 0.011 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 56 found files, scanned paths: 
mkiv lua stats  > stored bytecode data      - 303 modules, 65 tables, 368 chunks
mkiv lua stats  > cleaned up reserved nodes - 36 nodes, 9 lists of 436
mkiv lua stats  > node memory usage         - 12 hlist, 3 vlist, 3 rule, 12 glue, 1 penalty, 8 glyph, 36 attribute, 29 glue_spec, 12 attribute_list, 1 temp, 1 local_par, 2 dir, 4 pdf_literal, 2 pdf_setmatrix, 2 pdf_save, 2 pdf_restore
mkiv lua stats  > node list callback tasks  - 6 unique task lists, 4 instances (re)created, 102 calls
mkiv lua stats  > used backend              - pdf (backend for directly generating pdf output)
mkiv lua stats  > loaded patterns           - en::2
mkiv lua stats  > jobdata time              - 0.000 seconds saving, 0.001 seconds loading
mkiv lua stats  > callbacks                 - 183 direct, 565 indirect, 748 total
mkiv lua stats  > randomizer                - resumed with value 0.080291813742505
mkiv lua stats  > result saved in file      - g.pdf
mkiv lua stats  > loaded fonts              - 33 files: stmary10.afm lmmono12-regular.otf lmmono8-regular.otf lmmono9-regular.otf lmroman12-bold.otf lmroman12-regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf lmsans12-regular.otf lmsans8-regular.otf lmsans9-regular.otf eufb10.tfm eufb7.tfm eufm10.tfm eufm7.tfm msam10.tfm msam7.tfm msbm10.tfm msbm7.tfm lmex10.tfm lmmi12.tfm lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib7.tfm lmsy10.tfm lmsy7.tfm lmsy9.tfm rm-lmr12.tfm rm-lmr7.tfm rm-lmr9.tfm
mkiv lua stats  > fonts load time           - 0.344 seconds 
mkiv lua stats  > metapost processing time  - 0.002 seconds, loading: 0.074 seconds, execution: 0.002 seconds, n: 1
mkiv lua stats  > luatex banner             - this is luatex, version beta-0.70.1-2011051923 (rev 4277)
mkiv lua stats  > control sequences         - 33551 of 65536 + 100000
mkiv lua stats  > current memory usage      - 30 MB (ctx: 31 MB)
mkiv lua stats  > runtime                   - 20.278 seconds


[-- Attachment #4: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Font for MetaPost graphics
  2012-05-08 17:19               ` Marco
@ 2012-05-08 17:34                 ` Hans Hagen
  2012-05-08 19:57                   ` Marco
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2012-05-08 17:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 8-5-2012 19:19, Marco wrote:
> On 2012-05-08 Hans Hagen<pragma@wxs.nl>  wrote:
>
>> On 8-5-2012 19:01, Marco wrote:
>>> On 2012-05-05 Hans Hagen<pragma@wxs.nl>   wrote:
>>
>> Did I?
>
> My bad ;)
>
>>> This code fails:
>>>
>>> \defineMPinstance [mympinstance] [metafun] [textcolor=red]
>>>
>>> \starttext
>>>
>>> \startMPcode
>>> 	draw textext("some text") ;
>>> \stopMPcode
>>>
>>> \startMPcode{mympinstance}
>>> 	draw textext("some text") ;
>>> \stopMPcode
>>>
>>> \stoptext
>>>
>>> Marco
>>
>> It works here.
>
> Fails here, source and log are attached.

ok, can you add this to cont-new.mkiv (after \unprotect):

\def\m_meta_colo_initializations{%
     vardef OverlayLineColor=\MPcolor{\overlaylinecolor} enddef;
     vardef OverlayColor=\MPcolor{\overlaycolor} enddef;
}

I have that in my local experimental code. It has to do with the fact 
that mp's color spaces are not compatible with each other. As I've used 
that patch for quite a while now I could probably move it to the core.

Maybe more users can test this.

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
___________________________________________________________________________________


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

* Re: Font for MetaPost graphics
  2012-05-08 17:34                 ` Hans Hagen
@ 2012-05-08 19:57                   ` Marco
  2012-05-10  8:55                     ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 17+ messages in thread
From: Marco @ 2012-05-08 19:57 UTC (permalink / raw)
  To: ntg-context

On 2012-05-08 Hans Hagen <pragma@wxs.nl> wrote:

> ok, can you add this to cont-new.mkiv (after \unprotect):
> 
> \def\m_meta_colo_initializations{%
>      vardef OverlayLineColor=\MPcolor{\overlaylinecolor} enddef;
>      vardef OverlayColor=\MPcolor{\overlaycolor} enddef;
> }

That works.

> As I've used that patch for quite a while now I could probably
> move it to the core.

Since you use it for a while it seems to work ⇒ into the core

Thanks a lot Hans for implementing this.

Wikified:

http://wiki.contextgarden.net/Command/defineMPinstance
http://wiki.contextgarden.net/Command/setupMPinstance


Best wishes

Marco


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

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

* Re: Font for MetaPost graphics
  2012-05-08 19:57                   ` Marco
@ 2012-05-10  8:55                     ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-05-10  9:04                       ` Marco
  0 siblings, 1 reply; 17+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-05-10  8:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

many thanks Marco for wikifying.

On Tue, 08 May 2012 21:57:04 +0200, Marco <netuse@lavabit.com> wrote:

> Thanks a lot Hans for implementing this.
>
> Wikified:
>
> http://wiki.contextgarden.net/Command/defineMPinstance
> http://wiki.contextgarden.net/Command/setupMPinstance
>
>
> Best wishes
>
> Marco


With the permission, I tried to replace the tag <texcode> with <context> to get source and result.

<context mode="mkiv" source="yes" text="Gives:">
...
</context>

Unfortunately, the result doesn't appear.

So, what to do to make the example work?

Will it work automatically once the Ctx/MP engine updates on wiki?

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

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

* Re: Font for MetaPost graphics
  2012-05-10  8:55                     ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-05-10  9:04                       ` Marco
  0 siblings, 0 replies; 17+ messages in thread
From: Marco @ 2012-05-10  9:04 UTC (permalink / raw)
  To: ntg-context

On 2012-05-10 Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz> wrote:

> With the permission, I tried to replace the tag <texcode> with <context> to
> get source and result.
> 
> <context mode="mkiv" source="yes" text="Gives:">
> ...
> </context>
> 
> Unfortunately, the result doesn't appear.

The code is MkIV only and the wiki uses MkII.

> So, what to do to make the example work?

Find someone who has time to implement and administrate a working
MkIV wiki solution.

> Will it work automatically once the Ctx/MP engine updates on wiki?

*If* the engine gets updated someday, it will probably work, yes.


Marco


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

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

end of thread, other threads:[~2012-05-10  9:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-03  0:08 Font for MetaPost graphics Marco
2012-05-03  0:22 ` Aditya Mahajan
2012-05-03  1:13   ` Marco
2012-05-04  7:10     ` Mojca Miklavec
2012-05-04  7:13       ` Aditya Mahajan
2012-05-04 11:09         ` Marco
2012-05-05 10:26           ` Hans Hagen
2012-05-05 11:24         ` Hans Hagen
2012-05-05 14:07           ` Marco
2012-05-05 16:03             ` Aditya Mahajan
2012-05-08 17:01           ` Marco
2012-05-08 17:08             ` Hans Hagen
2012-05-08 17:19               ` Marco
2012-05-08 17:34                 ` Hans Hagen
2012-05-08 19:57                   ` Marco
2012-05-10  8:55                     ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-05-10  9:04                       ` Marco

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