From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/55778 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: coloring rules Date: Sun, 24 Jan 2010 14:02:52 +0100 Organization: Message-ID: <4B5C44FC.9070007@wxs.nl> References: <9C10C160-CF71-4E53-B034-11CC1291AC31@uva.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1264358052 5968 80.91.229.12 (24 Jan 2010 18:34:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jan 2010 18:34:12 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 24 19:34:04 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1NZ7HF-00023t-8e for gctc-ntg-context-518@m.gmane.org; Sun, 24 Jan 2010 19:33:37 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 512E8C9C9A; Sun, 24 Jan 2010 14:03:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RYXuSkBJAykd; Sun, 24 Jan 2010 14:03:37 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 26A1CC9C8D; Sun, 24 Jan 2010 14:03:37 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 33728C9C8D for ; Sun, 24 Jan 2010 14:03:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Rl6hBXgWQr-E for ; Sun, 24 Jan 2010 14:03:17 +0100 (CET) Original-Received: from mail.solcon.net (dsl-083-247-100-017.solcon.nl [83.247.100.17]) by balder.ntg.nl (Postfix) with ESMTP id 18840C9C8A for ; Sun, 24 Jan 2010 14:03:01 +0100 (CET) X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by controller-9 (SurgeMail 4.2d2) with ESMTP id 2696-1713362 for multiple; Sun, 24 Jan 2010 14:02:28 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b1 Thunderbird/3.0 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:55778 Archived-At: On 23-1-2010 14:32, Hans van der Meer wrote: > Further experimentation has shown that it is not impossible to color > \vrule's, thus \blackrule is not specifically needed. Let me first > mention that I put the colored rules away with \setbox\B=\hbox{} and > then later call \B up. It is a pity until now I am not able to concoct a > minimal example showing consistently the behaviour. > > However I have made the following observations: > define: \definecolor[mycolor][r=myR,g=myG,b=myB] > > (1) \color[mycolor]{rule} typesets a black rule > (2) \color[red]{something}\color[mycolor]{rule} typesets a mycolor rule > (3) \definecolor[green][r=myR,g=myG,b=myB]\color[mycolor]{rule} typesets > a mycolor rule > (4) changing the values of myR,myG,myB between runs keeps typesetting > the old mycolor > (5) it seems there is a memory effect on defined colors, something with > a cache that keeps me from changing things. > > It is mainly the seemingly erratic behaviour of the color changes that > puzzles me. I seem not being able to pinpoint a culprit. it's not that erratic at all, just do the same experiment with fonts ... In traditional tex color is implemented using specials and code is injected. Compare this with fonts: you choose a font, which sets a state and that state carries with the following glyphs till set otherwise (or restored). Boxing and unboxing keeps that state. In mkiv we use attributes for color (btw, the mk.pdf documents mentions al those things). And attributes are kept with objects and as a result are retained, which in my opinion is as it shoul dbe. So, in traditional tex you have: box == somerule [somecolor][thatbox] which effectively is [somecolor]somerule so the rule gets somecolor but if you have box == [somecolor]somerule [anothercolor][thatbox] you have [anothercolor][somecolor]somerule and te box will stay somecolor in mkiv nocolor is really nocolor so in the first example your rule will be black (as it has no attribute set and will not gte one set either as a box has frozen states When I wrote the backend code for colors I added an inheritance model but it's not yet perfect (and might even disappear or change). \starttext x\definecolor[mycolor][green]\color[mycolor]{\vrule width 10cm}x \setbox0\hbox{x\color[mycolor]{\vrule width 10cm}x} x\definecolor[mycolor][red]\color[mycolor]{\vrule width 10cm}x \color[mycolor]{\copy0} \enableattributeinheritance \color[mycolor]{\attributedcopy0} \stoptext Your bad luck is that inheritance does not play well with rules currently. On the other hand, the fact that you could this in mkii is no proof that it's the right way to do it. Most attribute driven features behave like fonts have been doing in mkii for ages. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________