Re: [NTG-context] A better \definesymbol sought

2017-01-25 Thread Hans Hagen

On 1/24/2017 8:01 PM, Rik Kabel wrote:

On 2017-01-24 03:34, Hans Hagen wrote:

On 1/24/2017 4:04 AM, Rik wrote:


What I want is that the background of the page (yellow in this case)
should show through. That is what is done with fill / reverse / cycle,
as in:

\setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
\startuseMPgraphic{CircleTest}
  path p,q ;
  p := fullcircle scaled 2cm ;
  q := fullcircle scaled 1cm ;
  fill p -- reverse q -- cycle withcolor blue;
\stopuseMPgraphic
\starttext
 \useMPgraphic{CircleTest}
\stoptext

where the background color (yellow) comes through the inner circle
(path q).

Can this be done with text characters? I suspect that the answer is that
the glyphs have to be converted to paths and that it will only work when


\setupbackgrounds
  [page]
  [background=color,
   backgroundcolor=yellow]
\starttext
\startcolor[blue]\starteffect[outer]PQR\stopeffect\stopcolor
\stoptext



Still not there.

Is there a way to define the ? characters to remove their coloring in
the output of the following so that the background yellow appears
through the outline even within the portions of the ?s placed on the
blue heart? I want to be able to place this over arbitrary text and
color backgrounds (stencil-like) so that the arbitrary text and
background color shows through.



\setupbackgrounds
  [page]
  [background={color,bgtext},backgroundcolor=yellow]
\definelayer
  [bgtext]
  [x=1in,
   y=2.0in,
   state=start]
\setlayerframed
  [bgtext]
  {\setupbodyfont[36pt]@@@}
\definefont
  [DVSrB]
  [file:DejaVuSerif-Bold.ttf]
\startbuffer[Outer]
 \startcolor[blue]
   \starteffect
 [outer]
 {\DVSrB ???}
   \stopeffect
 \stopcolor
\stopbuffer
\startuseMPgraphic{HeartTest}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 5 ;
  q := textext("{\getbuffer[Outer]}") scaled 3 ;
  draw h withcolor blue ;
  draw q ;
\stopuseMPgraphic
\starttext
\starttext
 \useMPgraphic{HeartTest}
\stoptext


\setupbackgrounds
  [page]
  [background={color,bgtext},
   backgroundcolor=yellow]

\definelayer
  [bgtext]
  [x=1in,
   y=2.0in,
   state=start]

\setlayerframed
  [bgtext]
  {\setupbodyfont[36pt]@@@}

\definefont
  [DVSrB]
  [file:DejaVuSerif-Bold.ttf*default]

\startuseMPgraphic{HeartTest}
draw outlinetext.f
("\DVSrB ♥")
(withcolor red)
scaled 5 ;
draw outlinetext.b
("\DVSrB ???")
(withcolor yellow)
(withcolor blue)
scaled 3 ;
\stopuseMPgraphic

\starttext
\useMPgraphic{HeartTest}
\stoptext

--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] A better \definesymbol sought

2017-01-24 Thread Rik Kabel

On 2017-01-24 03:34, Hans Hagen wrote:

On 1/24/2017 4:04 AM, Rik wrote:


What I want is that the background of the page (yellow in this case)
should show through. That is what is done with fill / reverse / cycle,
as in:

\setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
\startuseMPgraphic{CircleTest}
  path p,q ;
  p := fullcircle scaled 2cm ;
  q := fullcircle scaled 1cm ;
  fill p -- reverse q -- cycle withcolor blue;
\stopuseMPgraphic
\starttext
 \useMPgraphic{CircleTest}
\stoptext

where the background color (yellow) comes through the inner circle 
(path q).


Can this be done with text characters? I suspect that the answer is that
the glyphs have to be converted to paths and that it will only work when


\setupbackgrounds
  [page]
  [background=color,
   backgroundcolor=yellow]
\starttext
\startcolor[blue]\starteffect[outer]PQR\stopeffect\stopcolor
\stoptext



Still not there.

Is there a way to define the ? characters to remove their coloring in 
the output of the following so that the background yellow appears 
through the outline even within the portions of the ?s placed on the 
blue heart? I want to be able to place this over arbitrary text and 
color backgrounds (stencil-like) so that the arbitrary text and 
background color shows through.




   \setupbackgrounds
  [page]
  [background={color,bgtext},backgroundcolor=yellow]
   \definelayer
  [bgtext]
  [x=1in,
   y=2.0in,
   state=start]
   \setlayerframed
  [bgtext]
  {\setupbodyfont[36pt]@@@}
   \definefont
  [DVSrB]
  [file:DejaVuSerif-Bold.ttf]
   \startbuffer[Outer]
 \startcolor[blue]
   \starteffect
 [outer]
 {\DVSrB ???}
   \stopeffect
 \stopcolor
   \stopbuffer
   \startuseMPgraphic{HeartTest}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 5 ;
  q := textext("{\getbuffer[Outer]}") scaled 3 ;
  draw h withcolor blue ;
  draw q ;
   \stopuseMPgraphic
   \starttext
   \starttext
 \useMPgraphic{HeartTest}
   \stoptext


--
Rik



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

Re: [NTG-context] A better \definesymbol sought

2017-01-24 Thread Hans Hagen

On 1/24/2017 4:04 AM, Rik wrote:

On 2017-01-23 14:09, Rik Kabel wrote:

On 2017-01-23 00:06, Alan Braslau wrote:
> On Sun, 22 Jan 2017 22:39:53 -0500 Rik Kabel >  wrote: 
> >> So, how can I make the
inner glyph (‘?’ in the example below) >> transparent, so that the
background shows through along with >> anything else that lives on a
lower layer? I’ve seen a method for >> constructed shapes, but nothing
that I can apply to text glyphs. >> Undraw doesn’t do it. > > Undraw
is simply draw using the background color. > > Transparency is a
MetaFun extension to MetaPost (so part of > ConTeXt). > > draw q
withtransparency (1,0.5) ; % (method,transparency) > > Alan

Hmmm. That does not work for me (with any of many method and
transparency values).  The  ‘?’ is solid black. I do see a message in
the log that looks related:

mkiv lua stats  > page group warning: transparencies are used but
no pagecolormodel is set

but adding \setcolors[state=start,cmyk=yes] does not change that; both
the warning and the solid black glyph remain. Could this be an issue
of the PDF viewer? Is it a font issue?

Okay, I got a clean compile using \definecolor and referencing that in
the MP page.

\setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
\definecolor[Transp][r=1,t=0,a=12]
\definefont
  [DVSrB]
  [file:DejaVuSerif-Bold.ttf]
\startuseMPgraphic{HeartTest 1}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 20 ;
  q := textext("{\DVSrB ?}") scaled 10 ;
  q := q shifted - (xpart center q, 12pt) ;
  draw h withcolor blue ;
  draw q withtransparency(12,0) ;
  draw q shifted (72pt,0) withtransparency(12,0) ;
\stopuseMPgraphic
\startuseMPgraphic{HeartTest 2}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 20 ;
  q := textext("\color[Transp]{\DVSrB ?}") scaled 10 ;
  q := q shifted - (xpart center q, 12pt) ;
  draw h withcolor blue ;
  draw q ;
  draw q shifted (72pt,0) ;
\stopuseMPgraphic
\starttext
 \useMPgraphic{HeartTest 1}
 \useMPgraphic{HeartTest 2}
\stoptext

Unfortunately, the result is not what I want. The result is that the “?”
disappears, allowing the color directly behind it to show through. The
example above shows that it works with \definecolor but not
withwithtransparency. I have no idea why, and certainly realize it could
be my error.

What I want is that the background of the page (yellow in this case)
should show through. That is what is done with fill / reverse / cycle,
as in:

\setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
\startuseMPgraphic{CircleTest}
  path p,q ;
  p := fullcircle scaled 2cm ;
  q := fullcircle scaled 1cm ;
  fill p -- reverse q -- cycle withcolor blue;
\stopuseMPgraphic
\starttext
 \useMPgraphic{CircleTest}
\stoptext

where the background color (yellow) comes through the inner circle (path q).

Can this be done with text characters? I suspect that the answer is that
the glyphs have to be converted to paths and that it will only work when


\setupbackgrounds
  [page]
  [background=color,
   backgroundcolor=yellow]
\starttext
\startcolor[blue]\starteffect[outer]PQR\stopeffect\stopcolor
\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] A better \definesymbol sought

2017-01-23 Thread Rik

On 2017-01-23 14:09, Rik Kabel wrote:

On 2017-01-23 00:06, Alan Braslau wrote:
> On Sun, 22 Jan 2017 22:39:53 -0500 Rik Kabel >  wrote: > >> So, how can I make the 
inner glyph (‘?’ in the example below) >> transparent, so that the 
background shows through along with >> anything else that lives on a 
lower layer? I’ve seen a method for >> constructed shapes, but nothing 
that I can apply to text glyphs. >> Undraw doesn’t do it. > > Undraw 
is simply draw using the background color. > > Transparency is a 
MetaFun extension to MetaPost (so part of > ConTeXt). > > draw q 
withtransparency (1,0.5) ; % (method,transparency) > > Alan


Hmmm. That does not work for me (with any of many method and 
transparency values).  The  ‘?’ is solid black. I do see a message in 
the log that looks related:


mkiv lua stats  > page group warning: transparencies are used but
no pagecolormodel is set

but adding \setcolors[state=start,cmyk=yes] does not change that; both 
the warning and the solid black glyph remain. Could this be an issue 
of the PDF viewer? Is it a font issue?
Okay, I got a clean compile using \definecolor and referencing that in 
the MP page.


   \setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
   \definecolor[Transp][r=1,t=0,a=12]
   \definefont
  [DVSrB]
  [file:DejaVuSerif-Bold.ttf]
   \startuseMPgraphic{HeartTest 1}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 20 ;
  q := textext("{\DVSrB ?}") scaled 10 ;
  q := q shifted - (xpart center q, 12pt) ;
  draw h withcolor blue ;
  draw q withtransparency(12,0) ;
  draw q shifted (72pt,0) withtransparency(12,0) ;
   \stopuseMPgraphic
   \startuseMPgraphic{HeartTest 2}
  picture h,q ;
  h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 20 ;
  q := textext("\color[Transp]{\DVSrB ?}") scaled 10 ;
  q := q shifted - (xpart center q, 12pt) ;
  draw h withcolor blue ;
  draw q ;
  draw q shifted (72pt,0) ;
   \stopuseMPgraphic
   \starttext
 \useMPgraphic{HeartTest 1}
 \useMPgraphic{HeartTest 2}
   \stoptext

Unfortunately, the result is not what I want. The result is that the “?” 
disappears, allowing the color directly behind it to show through. The 
example above shows that it works with \definecolor but not 
withwithtransparency. I have no idea why, and certainly realize it could 
be my error.


What I want is that the background of the page (yellow in this case) 
should show through. That is what is done with fill / reverse / cycle, 
as in:


   \setupbackgrounds
  [page]
  [background=color,backgroundcolor=yellow]
   \startuseMPgraphic{CircleTest}
  path p,q ;
  p := fullcircle scaled 2cm ;
  q := fullcircle scaled 1cm ;
  fill p -- reverse q -- cycle withcolor blue;
   \stopuseMPgraphic
   \starttext
 \useMPgraphic{CircleTest}
   \stoptext

where the background color (yellow) comes through the inner circle (path q).

Can this be done with text characters? I suspect that the answer is that 
the glyphs have to be converted to paths and that it will only work when 
there are no islands (as in ‘P’).


--
Rik
___
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
___

Re: [NTG-context] A better \definesymbol sought

2017-01-23 Thread Rik Kabel

On 2017-01-23 00:06, Alan Braslau wrote:
On Sun, 22 Jan 2017 22:39:53 -0500 Rik Kabel  >  wrote: > >> So, how can I make the 
inner glyph (‘?’ in the example below) >> transparent, so that the 
background shows through along with >> anything else that lives on a 
lower layer? I’ve seen a method for >> constructed shapes, but nothing 
that I can apply to text glyphs. >> Undraw doesn’t do it. > > Undraw is 
simply draw using the background color. > > Transparency is a MetaFun 
extension to MetaPost (so part of > ConTeXt). > > draw q 
withtransparency (1,0.5) ; % (method,transparency) > > Alan


Hmmm. That does not work for me (with any of many method and 
transparency values).  The  ‘?’ is solid black. I do see a message in 
the log that looks related:


   mkiv lua stats  > page group warning: transparencies are used but no
   pagecolormodel is set

but adding \setcolors[state=start,cmyk=yes] does not change that; both 
the warning and the solid black glyph remain. Could this be an issue of 
the PDF viewer? Is it a font issue?


--
Rik
___
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
___

Re: [NTG-context] A better \definesymbol sought

2017-01-22 Thread Alan Braslau
On Sun, 22 Jan 2017 22:39:53 -0500
Rik Kabel  wrote:

> So, how can I make the inner glyph (‘?’ in the example below)
> transparent, so that the background shows through along with anything
> else that lives on a lower layer? I’ve seen a method for constructed
> shapes, but nothing that I can apply to text glyphs. Undraw doesn’t
> do it.

Undraw is simply draw using the background color.

Transparency is a MetaFun extension to MetaPost (so part of ConTeXt).

draw q withtransparency (1,0.5) ; % (method,transparency)

Alan
___
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
___

Re: [NTG-context] A better \definesymbol sought

2017-01-22 Thread Rik Kabel

On 2017-01-20 23:54, Alan Braslau wrote:

On Fri, 20 Jan 2017 22:33:40 -0500
Rik Kabel  wrote:


Can anyone suggest a better way to compose such symbols than using
the raw TeX commands used here? Is there a more ConTeXt-ish way to do
this? Is it possible to get options to center the glyphs from which
the symbol is assembled (separate horizontal and vertical, with the
ability to offset them)?

Is there a ConTeXt way other than \definesymbol to create such
combined symbols?

MetaPost (with textext())?


Thank you for that, Alan. I hadn’t ever used MetaPost before, thinking 
it was too complex for my needs. Now I see it may be quite useful.


So, how can I make the inner glyph (‘?’ in the example below) 
transparent, so that the background shows through along with anything 
else that lives on a lower layer? I’ve seen a method for constructed 
shapes, but nothing that I can apply to text glyphs. Undraw doesn’t do it.


  \setupbackgrounds
   [page]
   [background=color,backgroundcolor=yellow]
 \definefont
   [DVSrB]
   [file:DejaVuSerif-Bold.ttf]
 \startuseMPgraphic{HeartTest}
   picture h;
   h := "♥" infont "\truefontname{DejaVuSerif-Bold.ttf}" scaled 20;
   picture q;
   q := textext("{\DVSrB ?}") scaled 10; % just a different way
   q := q shifted - (xpart center q, 12pt) ;
   draw h withcolor blue;
   undraw q;   % this doesn't do it
 \stopuseMPgraphic
 \starttext
   \useMPgraphic{HeartTest}
 \stoptext

--
Rik

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

Re: [NTG-context] A better \definesymbol sought

2017-01-20 Thread Alan Braslau
On Fri, 20 Jan 2017 22:33:40 -0500
Rik Kabel  wrote:

> Can anyone suggest a better way to compose such symbols than using
> the raw TeX commands used here? Is there a more ConTeXt-ish way to do
> this? Is it possible to get options to center the glyphs from which
> the symbol is assembled (separate horizontal and vertical, with the
> ability to offset them)?
> 
> Is there a ConTeXt way other than \definesymbol to create such
> combined symbols?

MetaPost (with textext())?
___
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
___