ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik <rik@panix.com>
To: ntg-context@ntg.nl
Subject: Re: A better \definesymbol sought
Date: Mon, 23 Jan 2017 22:04:31 -0500	[thread overview]
Message-ID: <d8c40bf7-1b76-4f86-997c-ed6ce94d8704@panix.com> (raw)
In-Reply-To: <2117dc0b-6e30-c1fa-8b26-8eb2b6114b52@rik.users.panix.com>


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

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 > <context@rik.users.panix.com> 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

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

[-- Attachment #2: Type: text/plain, Size: 492 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
___________________________________________________________________________________

  reply	other threads:[~2017-01-24  3:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-21  3:33 Rik Kabel
2017-01-21  4:54 ` Alan Braslau
2017-01-23  3:39   ` Rik Kabel
2017-01-23  5:06     ` Alan Braslau
2017-01-23 19:09       ` Rik Kabel
2017-01-24  3:04         ` Rik [this message]
2017-01-24  8:34           ` Hans Hagen
2017-01-24 19:01             ` Rik Kabel
2017-01-25 10:17               ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8c40bf7-1b76-4f86-997c-ed6ce94d8704@panix.com \
    --to=rik@panix.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).