From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95573 Path: news.gmane.org!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Re: Optimize code to create a environnementt with Metafun ? Date: Tue, 26 Jul 2016 14:20:22 +0200 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5202243305900381413==" X-Trace: ger.gmane.org 1469535672 26871 80.91.229.3 (26 Jul 2016 12:21:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2016 12:21:12 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 26 14:21:01 2016 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 plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bS1M3-0003KQ-Rl for gctc-ntg-context-518@m.gmane.org; Tue, 26 Jul 2016 14:20:59 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B186912F9D; Tue, 26 Jul 2016 14:20:38 +0200 (CEST) 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 SxwfWZ5M3GPy; Tue, 26 Jul 2016 14:20:37 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id C64D712F9A; Tue, 26 Jul 2016 14:20:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3353012F98 for ; Tue, 26 Jul 2016 14:20:36 +0200 (CEST) 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 oE3Kv-xsLYWH for ; Tue, 26 Jul 2016 14:20:35 +0200 (CEST) Original-Received: from mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CAA7C12F92 for ; Tue, 26 Jul 2016 14:20:24 +0200 (CEST) Original-Received: by mail-io0-f174.google.com with SMTP id b62so16320343iod.3 for ; Tue, 26 Jul 2016 05:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BOS8kpExn3A+ULlT9Nhf5JriAo3JPhYIoezSXer4aus=; b=FzOgFPSaCtNRTYARXtvdzsCesa51ndoecoJNMyY9ETexBR/PwESBzA4ZR2ZZc2E0ct XPlt8VCa7K246FdAMGuvgvK078PMvYEhVvghTK4vvhBxMGBsr4I1A0tpS8dBXwedbf6E C+6mTOINmyLzJwVjFEP+Q3KjydwCWlRobwtV51dkjgXwJ4/B+IdOsLh/WvCzl2OJ6jrL 1b3qpaQFPqEqjT8XlI0tO6yOZRfPQ5kPYDsIarUcpLFohyvPlm/+uammb9Wo3t/hqDm4 3FHGUp13GZNrowWaOeL2tjyKmVP4fGAWQzriMAN16KbPaLhqmf3c7SXDliUsm/u21a5I xB3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BOS8kpExn3A+ULlT9Nhf5JriAo3JPhYIoezSXer4aus=; b=HEfxNcf8CusjIrTEmPjtAGXLA9jKPkDxK35mKZRKNRAXjba5ZRp3OI8vpUh2Y/CHC9 0XVK9iyAS/kJIlZGXDyqRrwKJIRrvorXxumetoWIRn1xFuDxiX14YRvglCQgKuSXDGBX zj6Ra0GDTiT85VNYBODPJ1bAWyn9L1Q3sV40NFjQfQsXs1vWtEtp6OftJWn2oGH7gPFB bibpYSXpr/Bly63490VH/ppXpzYYF4y+9wEqZzyh2uVjBmUwrSSohvAXo6Dd2ZyX2gWL DV1AdK31cabKSoOe9t7fpeFq0b3P6M6e7CHK4ilLdqPjlBy6YSG2lAG0wWCWBOFXs3Vm WNOw== X-Gm-Message-State: AEkoous2HIZp0GgwJRIq2jK7DXgqYl9eRKUH4+rbv330jBuicBNO98LhccCgL65rEJCQNV0JQmhxznZ6uC+wGQ== X-Received: by 10.107.185.133 with SMTP id j127mr26141285iof.32.1469535622932; Tue, 26 Jul 2016 05:20:22 -0700 (PDT) Original-Received: by 10.64.212.204 with HTTP; Tue, 26 Jul 2016 05:20:22 -0700 (PDT) In-Reply-To: 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:95573 Archived-At: --===============5202243305900381413== Content-Type: multipart/alternative; boundary=94eb2c070a1cca2e04053888ec45 --94eb2c070a1cca2e04053888ec45 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Hans, So the code is "perfect" ? : =3D) typography? sure, but more a discussion topic at the ctx meeting Seriously, where can we read the conference proceedings ? Thanks Fabrice 2016-07-26 12:34 GMT+02:00 Hans Hagen : > On 7/26/2016 10:18 AM, Fabrice Couvreur wrote: > >> Hello, >> Hans and Wolfgang really helped me to create new environments with >> Metafun. >> I think Hans continuous development Metafun. So my question is simple: >> can we optimize this code? >> > > in what sense ... > > speed? not much to gain > > correctness? mayhe use "lightgray" and "darkred" for consistency > > typography? sure, but more a discussion topic at the ctx meeting > > Thanks, >> Fabrice >> >> \setupbodyfont[pagella,11pt] >> >> \setupcolors[state=3Dstart] >> >> \defineframedtext >> [MyDefinition] >> [before=3D{\blank}, >> after=3D{\blank}, >> frame=3Doff, >> background=3DMyFrame, >> width=3D\textwidth, >> height=3Dfit, >> style=3Ditalic] >> >> \definelabel >> [D=C3=A9finition] >> [headstyle=3D\bf\smallcaps] >> >> \startuseMPgraphic{MyFrame} >> path b; >> picture p; >> p :=3D textext.rt("\white\D=C3=A9finition"); >> p :=3D p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeigh= t); >> b :=3D boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth; >> fill OverlayBox withcolor \MPcolor{lightgray}; >> fill b withcolor darkred; >> draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor >> darkred; >> draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor >> darkred; >> draw p; >> setbounds currentpicture to boundingbox currentpicture enlarged 2mm; >> \stopuseMPgraphic >> >> \defineoverlay >> [MyFrame] >> [\useMPgraphic{MyFrame}] >> >> \starttext >> >> \showframe >> >> \startMyDefinition >> \input knuth >> \stopMyDefinition >> >> \stoptext >> >> >> >> >> ________________________________________________________________________= ___________ >> If your question is of interest to others as well, please add an entry t= o >> 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 >> >> ________________________________________________________________________= ___________ >> >> > > -- > > ----------------------------------------------------------------- > 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://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ --94eb2c070a1cca2e04053888ec45 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Hans,
So the co= de is "perfect" ? : =3D)

typography? sure, but more a discussion topic at the ctx meetin= g
=C2=A0
Seriously, where can we<= /span> read the conference proceedings ?
= Thanks
Fabrice

2016-07-26 12:34 GMT+02:00 Hans Ha= gen <pragma@wxs.nl>:
On 7/26/2016 10:18 AM, Fabrice Couvreur wrote:
Hello,
Hans and Wolfgang really helped me to create new environments with Metafun.=
I think Hans continuous development Metafun. So my question is simple:
can we optimize this code?

in what sense ...

speed? not much to gain

correctness? mayhe use "lightgray" and "darkred" for co= nsistency

typography? sure, but more a discussion topic at the ctx meeting

Thanks,
Fabrice

\setupbodyfont[pagella,11pt]

\setupcolors[state=3Dstart]

\defineframedtext
=C2=A0 [MyDefinition]
=C2=A0 [before=3D{\blank},
=C2=A0 =C2=A0after=3D{\blank},
=C2=A0 =C2=A0frame=3Doff,
=C2=A0 =C2=A0background=3DMyFrame,
=C2=A0 =C2=A0width=3D\textwidth,
=C2=A0 =C2=A0height=3Dfit,
=C2=A0 =C2=A0style=3Ditalic]

\definelabel
=C2=A0 [D=C3=A9finition]
=C2=A0 [headstyle=3D\bf\smallcaps]

\startuseMPgraphic{MyFrame}
=C2=A0path b;
=C2=A0picture p;
=C2=A0p :=3D textext.rt("\white\D=C3=A9finition");
=C2=A0p :=3D p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHei= ght);
=C2=A0b :=3D boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;<= br> =C2=A0fill OverlayBox withcolor \MPcolor{lightgray};
=C2=A0fill b withcolor darkred;
=C2=A0draw bottomboundary OverlayBox withpen pencircle scaled 1pt=C2=A0 wit= hcolor
darkred;
=C2=A0draw topboundary OverlayBox withpen pencircle scaled 1pt=C2=A0 withco= lor
darkred;
=C2=A0draw p;
=C2=A0setbounds currentpicture to boundingbox currentpicture enlarged 2mm;<= br> \stopuseMPgraphic

\defineoverlay
=C2=A0 [MyFrame]
=C2=A0 [\useMPgraphic{MyFrame}]

\starttext

\showframe

\startMyDefinition
\input knuth
\stopMyDefinition

\stoptext



___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/projects/con= textrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________



--

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 H= ans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ridderstraat 27 | 8061 GH = Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0tel: 038 477 53 69 | www.pragma-ade.nl | www.p= ragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/projects/con= textrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________

--94eb2c070a1cca2e04053888ec45-- --===============5202243305900381413== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============5202243305900381413==--