[NTG-context] \sometxt in staticMPfigure
Sanjoy Mahajan
sanjoy at mrao.cam.ac.uk
Tue Sep 26 18:17:22 CEST 2006
Hans Hagen wrote:
> test case:
>
> \setupcolors[state=start,textcolor=red]
> \starttext
> red
> \color[green]{green
> \startMPcode
> label(\sometxt{green\color[blue]{blue}green}, origin)
> withcolor red;
> draw fullcircle scaled 1cm xscaled 2;
> \stopMPcode
> green}
> red
> \stoptext
The test case works as you say (2006.09.26 beta). Though I don't
understand why [Note added later: I now understand, see at the
end...]: e.g. why the 'green' text in the \sometxt is green.
Shouldn't the withcolor red trump the \color[green] from ConTeXt? I
take your point about the lack of a color stack in metapost and the
difficulty of getting the metapost and context stacks to interact.
Here's a shorter example of what I'm confused about.
\setupcolors[state=start,textcolor=yellow]
\starttext
\startMPcode
label(\sometxt{?red?}, origin) withcolor red;
\stopMPcode
\stoptext
The label(\sometxt{...}) withcolor red would produce postscript code like
1 0 0 setrgbcolor
<font stuff for ?red?>
0 0 0 setrgbcolor
and that would be surrounded by code to set textcolor to yellow.
Oh, I understand now. The \sometxt{} wraps the ?red? in yellow
setrgbcolor, since that's seen first by ConTeXt, and *then* it's
wrapped by metapost in red setrgcolor, so the red is overridden by the
yellow inside it.
-Sanjoy
`Never underestimate the evil of which men of power are capable.'
--Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
More information about the ntg-context
mailing list