From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/97143 Path: news.gmane.org!.POSTED!not-for-mail From: Rik Newsgroups: gmane.comp.tex.context Subject: Re: A better \definesymbol sought Date: Mon, 23 Jan 2017 22:04:31 -0500 Message-ID: References: <348a2b7f-e3ff-ce93-e0e9-ca14b9440306@rik.users.panix.com> <20170120215443.62bbdfb2@zoo.hsd1.co.comcast.net> <20170122220638.6001fa7e@zoo.hsd1.co.comcast.net> <2117dc0b-6e30-c1fa-8b26-8eb2b6114b52@rik.users.panix.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7303587657772303798==" X-Trace: blaine.gmane.org 1485227134 1219 195.159.176.226 (24 Jan 2017 03:05:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 24 Jan 2017 03:05:34 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Jan 24 04:05:29 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVrPu-0006Ti-6w for gctc-ntg-context-518@m.gmane.org; Tue, 24 Jan 2017 04:05:06 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4620112602BC; Tue, 24 Jan 2017 04:04:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xNKPSu4_aF_t; Tue, 24 Jan 2017 04:04:47 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 5084112602C7; Tue, 24 Jan 2017 04:04:47 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7A40F12602BE for ; Tue, 24 Jan 2017 04:04:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NoA2RgHnuSN9 for ; Tue, 24 Jan 2017 04:04:45 +0100 (CET) Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 9180112602BC for ; Tue, 24 Jan 2017 04:04:35 +0100 (CET) Original-Received: from [192.168.201.10] (cpe-24-194-22-135.nycap.res.rr.com [24.194.22.135]) by mailbackend.panix.com (Postfix) with ESMTPSA id 53A8313FDC for ; Mon, 23 Jan 2017 22:04:34 -0500 (EST) In-Reply-To: <2117dc0b-6e30-c1fa-8b26-8eb2b6114b52@rik.users.panix.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:97143 Archived-At: This is a multi-part message in MIME format. --===============7303587657772303798== Content-Type: multipart/alternative; boundary="------------3CA4387F0CD4301C8977CA5A" This is a multi-part message in MIME format. --------------3CA4387F0CD4301C8977CA5A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------3CA4387F0CD4301C8977CA5A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
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 with withtransparency. 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
--------------3CA4387F0CD4301C8977CA5A-- --===============7303587657772303798== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============7303587657772303798==--