Re: [NTG-context] new beta

2015-06-14 Thread Mojca Miklavec
On Sat, Jun 13, 2015 at 10:00 AM, Hans Hagen wrote:
 Hi,

 I uploaded a beta. The most significant (visible) change is in the way mp
 handles outlines. Here are some examples:

 % outlinetext   (text) transformations ;
 % outlinetext.d (text) (draw options) transformations ;
 % outlinetext.f (text) (fill options) transformations ;
 % outlinetext.b (text) (draw options) (fill options) transformations ;
 % outlinetext.r (text) (fill options) (draw options) transformations ;

 \starttext

 \startMPpage

 draw outlinetext.b
 (\framed[align=normal]{\input{tufte}})
 (withcolor .5white)
 (withcolor red withpen pencircle scaled 1/10)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 draw outlinetext.r
 (\framed[align=normal]{\input{tufte}})
 (withcolor red withpen pencircle scaled 1/10)
 (withcolor .5white)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 draw outlinetext.d
 (\framed[align=normal]{\input{tufte}})
 (withcolor .5white)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 picture p ; p := outlinetext.p(PX) ;

 for i within p :
 draw i withcolor red withpen pencircle scaled 1/10 ;
 endfor ;

 \stopMPpage

 \stoptext

Amazing.

This also makes it easy to drop a shadow, a simplified version being
something like:

\starttext

\startbuffer
\framed[align=normal]{\bf\input{tufte}}
\stopbuffer

\startMPpage

draw outlinetext.b
(\getbuffer)
(withcolor .85white)
(withcolor .85white withpen pencircle scaled 1)
shifted (0.5,-0.5) ;

draw outlinetext.f
(\getbuffer)
(withcolor .7white)
shifted (0.5,-0.5) ;

draw outlinetext.b
(\getbuffer)
(withcolor yellow)
(withcolor black withpen pencircle scaled 1/10);

\stopMPpage

\stoptext

... but I believe one could now address this*** as well (with some
extra hacking of shadings):
http://tex.stackexchange.com/a/52823/6367
;) ;) ;)


The font previews are also amazing.

Mojca

*** Some time ago someone made me a poster on a colourful background
in Photoshop (background had both black and white elements). He used a
white font with black outline and gray dropped shadow. I reproduced
the content in ConTeXt, but I wasn't able to reproduce the nice shadow
that made the text stand out better and thus more readable. In the
printing house they asked me why I went from good to worse (ie. from
PhotoShop to TeX) by decreasing the visibility of letters. I assume
that doing smooth shadow behind the letters should finally be possible
in ConTeXt now as well. [Alan will probably disagree.]
___
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] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
On Thu, Jun 11, 2015 at 11:26 PM, Hans Hagen wrote:
 On Thu, 11 Jun 2015, Mojca Miklavec wrote:

 Hi,

 I would like to ask for help for either finding a fix or some clever
 workaround for the following problem.

 If I use a TikZ picture as item symbol and additionally use background
 text, then the first symbol in itemize environment gets covered by the
 background. Here's an example:

 \usemodule
 [tikz]

 \definesymbol[1]
 [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}]

 \definecolor
 [backcol]
 [s=1,a=1,t=0.1]

 \starttext

 \startframedtext[width=4cm,background=color,backgroundcolor=backcol]
 \startitemize
 \item one
 \item two
 \item three
 \stopitemize
 \stopframedtext

 \stoptext

 i suppose that tikz puts some pdf code in the output stream and this is
 likely to interfere with the way context deals with colors

 a solution is:

 {\red x\dontleavehmode\forcecolorhack\tikz\fill[color=blue] (0,0) circle
 (.2cm);x}

 the

 \forcecolorhack

 is, well, a hack that fools the optimizer and \dontleavehmode is needed to
 get tex in the right mode

Thank you very much. Using the following worked fine as a workaround.

\definesymbol[1]
[{\dontleavehmode\forcecolorhack\tikz\shade[shading=ball,ball
color=blue] (0,0) circle (.2cm);}]

Meanwhile I filed a ticket to the pgf's bug tracker to help us
remember specifics about the problem.

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] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
See also:
http://tex.stackexchange.com/questions/54193/how-to-draw-a-shaded-sphere

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] TikZ and wrong drawing order

2015-06-14 Thread Mojca Miklavec
On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote:

 Most shades look ugly and useless to me anyway but you have more control
 than you think (always had but nicer interfaced in mpiv):

 \startMPpage
 fill fullcircle scaled 10cm
 withshademethod circular
 withshadevector (5cm,1cm)
 withshadecenter (.1,.5)
 withshadedomain (.2,.6)
 withshadefactor 1.2
 withshadecolors (red,green)
 ;
 \stopMPage

Great, I love the new syntax (compared to the MKII ugliness of shadings).

But how does one declare more than one colour? In particular, how
would you do the following in MP?

\usemodule
[tikz]

\pgfdeclareverticalshading{rainbow}{100bp}{
color(0bp)=(red);
color(25bp)=(red);
color(35bp)=(yellow);
color(45bp)=(green);
color(55bp)=(cyan);
color(65bp)=(blue);
color(75bp)=(violet);
color(100bp)=(violet)}

\starttext
\starttikzpicture[shading=rainbow]
\shade[shading angle=90] (0,0) rectangle +(10,1);
\stoptikzpicture
\stoptext

 Of course you need to play with the values as there is no 'best'
 combination.

This is how TikZ defines the ball:

\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{%
 color(0bp)=(tikz@ball!15!white);
 color(9bp)=(tikz@ball!75!white);
 color(18bp)=(tikz@ball!70!black);
 color(25bp)=(tikz@ball!50!black);
 color(50bp)=(black)}

Your example uses just two colours, while TikZ uses five and I don't
know how to translate this ball shading to MP (I know or at least
knew how to do it in plain PostScript and could dig it up; I think it
uses function shading with predefined colours at predefined distances,
but it's all a single shading (a single function), not a composition
of multiple sections).

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
___