From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95571 Path: news.gmane.org!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Optimize code to create a environnementt with Metafun ? Date: Tue, 26 Jul 2016 10:18:24 +0200 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9075589601703017275==" X-Trace: ger.gmane.org 1469521164 24964 80.91.229.3 (26 Jul 2016 08:19:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2016 08:19:24 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 26 10:19:13 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 1bRxa3-0007rr-9e for gctc-ntg-context-518@m.gmane.org; Tue, 26 Jul 2016 10:19:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2640412F22; Tue, 26 Jul 2016 10:18:41 +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 gFWHRFhF4kzD; Tue, 26 Jul 2016 10:18:38 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 81F8E12F1F; Tue, 26 Jul 2016 10:18:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8254A12F1A for ; Tue, 26 Jul 2016 10:18:37 +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 ykpvI7_2s_Iw for ; Tue, 26 Jul 2016 10:18:36 +0200 (CEST) Original-Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) (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 35D4E12F19 for ; Tue, 26 Jul 2016 10:18:26 +0200 (CEST) Original-Received: by mail-io0-f170.google.com with SMTP id 38so5666830iol.0 for ; Tue, 26 Jul 2016 01:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=Ogis61fFmwVg0gQCckmNlkOgIrxCJH39oiy3lixIAt0=; b=ajPovWLBYg5D0PG5AL+FpTN+psn36S7Zzipw8hIra5rIkajH120aqyjQksq1bzcLOM QGqSiPZMI8iCS9e7zfRbBjiZjVbULNW8+ujigs7O21K8duBX7UqkOyGxFb3s8jpfOU7c YNlBEPWs0wvlhpaNGK/qZJUV4rHhFy0DavtFPqiKyaGusf/rFvLNFERdS5HR61J7OctM DE3uY/4JUyTBswuf5sBqFtNyZqwYVeCi0kjH5HU/wwXxOdkP28UM4A++cE+9yRz2PbMD IjgXlIDk/tame0AMSAn3n7h5LJWAYkC4tReW4UvFJH7jiudhtVTCSGg4xgm+0dRKPear NC+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Ogis61fFmwVg0gQCckmNlkOgIrxCJH39oiy3lixIAt0=; b=FuOiX/FdgJNd7OMyNKp86W/7KnTeO4hyN0KVB8ag1e1dvGG1uwhhyR1fq9O4JNVqiq AxCa1L0Zqpg7RbB2TTTJvf5IIDX/4dhs5iHkOHsmSUQBNM8KyAgWuIMnq464Mq4TAVYL mtT3u0b3bxOTMcdP815p3KCA+bDl2hwMP2npEOHXaJWXgACWwOB49lcdBlOzu05q6e/a QrUDkP7jIg4WmAUILXAWqozupuz5GcWMBKF4BOmaItKrErxUouxKAbGrFVN/mR2hUfCl uuGtheVb3dQpy+mNlz9Pp2KsQdSEjtLAG3Z93bMKaBcbMhB/Ioy5SAChc+vcWaVDQcd5 BHog== X-Gm-Message-State: AEkoouujMk38co6fue60XZgqB7EbglWx0wzjYE2t8ReDJCSTJOUVp08+1qJNAwrdKd2uUPo8AGhsB/82Cbv/ag== X-Received: by 10.107.9.42 with SMTP id j42mr23901065ioi.33.1469521104450; Tue, 26 Jul 2016 01:18:24 -0700 (PDT) Original-Received: by 10.64.212.204 with HTTP; Tue, 26 Jul 2016 01:18:24 -0700 (PDT) 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:95571 Archived-At: --===============9075589601703017275== Content-Type: multipart/alternative; boundary=001a113df6ac6bbb2e0538858bae --001a113df6ac6bbb2e0538858bae Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 ? 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+.25ExHeight); 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 --001a113df6ac6bbb2e0538858bae Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,
Hans and Wolfgang= really helped me to create new environment= s with Metafun.
I t= hink Hans continuous development Metafun. So my question is= simple: can we optimize this code ?
Thanks,
Fabrice

\setupbodyfont[pagel= la,11pt]

\setupcolors[state=3Dstart]

\defineframedtext
=C2= =A0 [MyDefinition]
=C2=A0 [before=3D{\blank},
=C2=A0=C2=A0 after=3D{\= blank},
=C2=A0=C2=A0 frame=3Doff,
=C2=A0=C2=A0 background=3DMyFrame,<= br>=C2=A0=C2=A0 width=3D\textwidth,
=C2=A0=C2=A0 height=3Dfit,
=C2=A0= =C2=A0 style=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("\wh= ite\D=C3=A9finition");
=C2=A0p :=3D p shifted (2BodyFontSize,Overl= ayHeight-ypart center p+.25ExHeight);
=C2=A0b :=3D boundingbox p leftenl= arged .5EmWidth rightenlarged .5EmWidth;
=C2=A0fill OverlayBox withcolor= \MPcolor{lightgray};
=C2=A0fill b withcolor darkred;
=C2=A0draw bott= omboundary OverlayBox withpen pencircle scaled 1pt=C2=A0 withcolor darkred;=
=C2=A0draw topboundary OverlayBox withpen pencircle scaled 1pt=C2=A0 wi= thcolor darkred;
=C2=A0draw p;
=C2=A0setbounds currentpicture to boun= dingbox currentpicture enlarged 2mm;
\stopuseMPgraphic

\defineove= rlay
=C2=A0 [MyFrame]
=C2=A0 [\useMPgraphic{MyFrame}]

\startte= xt

\showframe

\startMyDefinition
\input knuth
\stopMyDe= finition

\stoptext

--001a113df6ac6bbb2e0538858bae-- --===============9075589601703017275== 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= --===============9075589601703017275==--