From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95578 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Optimize code to create a environnementt with Metafun ? Date: Tue, 26 Jul 2016 21:49:29 +0200 Message-ID: <5797BEC9.7060009@gmail.com> References: <86038346-3d77-2cb6-e45b-aa7f4f29e381@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5893970131917336917==" X-Trace: ger.gmane.org 1469562627 13009 80.91.229.3 (26 Jul 2016 19:50:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2016 19:50:27 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 26 21:50:12 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 1bS8Mj-0007kp-Hn for gctc-ntg-context-518@m.gmane.org; Tue, 26 Jul 2016 21:50:09 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1563313085; Tue, 26 Jul 2016 21:49:48 +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 F6VHSXrlKF_A; Tue, 26 Jul 2016 21:49:45 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id EF58C1308C; Tue, 26 Jul 2016 21:49:45 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3D15613087 for ; Tue, 26 Jul 2016 21:49:45 +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 nmuTzWoRcNYi for ; Tue, 26 Jul 2016 21:49:44 +0200 (CEST) Original-Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) (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 D089B13085 for ; Tue, 26 Jul 2016 21:49:33 +0200 (CEST) Original-Received: by mail-wm0-f42.google.com with SMTP id i5so31742457wmg.0 for ; Tue, 26 Jul 2016 12:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=WJyihIGLnjkrcG0WcP6NYNCmqjQZJlO9zfWoCtiIogc=; b=SVRFnE6VeiDxc3O30Vx06Cid3YHcvysbHgoF4/RyOhZryuMfAKWbJAQoCRYOXW2Rbs wKsc6Tzf8rZTahkCU8IUTDSdlnNCJBlAHWFZYH/euSx9o7XOjaX2uObMwNzFoFTEMmOO mD2WNd4sXYeXLyDIyb5C1TJpJNQeNCNI/S6YsulYHRFv7JjLG5aSDwt8n+CJZS/dc33Z T1IsILcd1agPbSQJ5y9QlZ9+elETw7G2cR6P/9t8yniqcRUn0rIRv5qNrfxUBkHQUVzt Vb4cmlrbqvco5Bi4ZuMosjib8g2ez5gVUJCf9Q9TJ7w3GYyvUtVN6njxutkSF8i+EgdR iDiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=WJyihIGLnjkrcG0WcP6NYNCmqjQZJlO9zfWoCtiIogc=; b=jA/rHhygwPHW4dTbdcNi2ZcnrGNslMMxl6mbftWDJfKCjs3Zyrq60R5Qv2Cos7jN22 nRfM3CUACSsIKAshdYCU749RDTLm7FiBMiV4tHhu3ELyxlWp0okpdh5WQur1N9FmsWgS djCMbSfZHH9pVkIVRj/5AdkuOlk2xFVNkA+onP8xzbVWR2f+F1ZMWAjinWmPPkgb9g9d Uu6xaqOEFvEmedX7TFFGdbfR0mn1MC9FO4D1eVix4LMFBLEwDc/QEICsc7CoKInEo1LB vLElkU7Ag9LMbLi9/nXJdCaGczx3RSY4oYydtXGqA1x7QsyaDc/ShZNVYSbxwHpDZr3e ZIJw== X-Gm-Message-State: AEkoouv0cuRcklFXIT1sOzm7K/5L7e8Eo4BO72DESvRQXrshMfRSUAOhsUkdfDMX4NRLxw== X-Received: by 10.28.40.133 with SMTP id o127mr24301334wmo.46.1469562572866; Tue, 26 Jul 2016 12:49:32 -0700 (PDT) Original-Received: from keima.localdomain (x2f26260.dyn.telefonica.de. [2.242.98.96]) by smtp.gmail.com with ESMTPSA id gw4sm2498680wjc.45.2016.07.26.12.49.31 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jul 2016 12:49:31 -0700 (PDT) User-Agent: Postbox 4.0.8 (Macintosh/20151105) 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:95578 Archived-At: This is a multi-part message in MIME format. --===============5893970131917336917== Content-Type: multipart/alternative; boundary="------------040908000309050605020708" This is a multi-part message in MIME format. --------------040908000309050605020708 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Fabrice Couvreur > 26. Juli 2016 um 20:21 > Hi Hans, > I think I was not very clear. > > > > Title first framed : Hans > > Title second framed : Hagen You can pass a title to the optional framedtext argument (use camel case to avoid using existing key names) and access the value later in the metapost graphic. > Thanks > Fabrice > > \setupbodyfont[pagella,11pt] > > \setupcolors[state=start] > > \defineframedtext > [MyFrame] > [before={\blank}, > after={\blank}, > frame=off, > background=MyFrame, > width=\textwidth, width=max, > height=fit, > style=italic] > > \setvariables > [text] > [text1=Hans, > text2=Hagen,] > > > \startuseMPgraphic{MyFrame} > path b; > picture p; > p := textext.rt("\white\getvariable{text}{text1}"); p := textext.rt("\white\framedtextparameter{Title}"); > p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); > b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth; > fill OverlayBox withcolor 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 > > > \startMyFrame > \input knuth > \stopMyFrame > > \startMyFrame > \input knuth > \stopMyFrame \startMyFrame[Title=Hans] \input knuth \stopMyFrame \startMyFrame[Title=Hagen] \input knuth \stopMyFrame Wolfgang --------------040908000309050605020708 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
26= .=20 Juli 2016 um 20:21
Hi Hans,
I think I was not very clear.



Title first=20 framed : Hans

Title second f= ramed : Hagen

You can pass a title to the optional framedtext argument (use camel case to avoid
using existing key names) and access the value later in the metapost=20 graphic.

Thanks
Fabrice
\setupbodyfont[pagella,11pt]

\setupcolors[state=3Dstart]

\= defineframedtext
=C2=A0 [MyFrame]
=C2=A0 [before=3D{\blank},
=C2=A0=C2=A0 after=3D{\blank}= ,
=C2=A0=C2=A0 frame=3Doff,
=C2=A0=C2=A0 background=3DMyFrame,
=C2=A0=C2=A0 width=3D\textwidth,
width=3Dmax,
=C2=A0=C2=A0 height=3Dfit,
=C2=A0=C2=A0 style=3Dital= ic]

\setvariables
=C2=A0 [text]
=C2=A0 [text1=3DHans,
=C2=A0=C2=A0 text2=3DHagen,]
=C2=A0= =C2=A0

\startuseMPgraphic{MyFrame}
=C2=A0path b;
=C2=A0picture p;
=C2=A0p :=3D=20 textext.rt("\white\getvariable{text}{text1}");

=C2=A0p :=3D textext.rt("\white\framedtextparameter{Title}");

=C2=A0p :=3D = p shifted=20 (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
=C2=A0b :=3D= =20 boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;
=C2=A0fi= ll=20 OverlayBox withcolor lightgray;
=C2=A0fill b withcolor darkred;
=C2= =A0draw=20 bottomboundary OverlayBox withpen pencircle scaled 1pt=C2=A0 withcolor=20 darkred;
=C2=A0draw topboundary OverlayBox withpen pencircle scaled 1p= t=C2=A0=20 withcolor darkred;
=C2=A0draw p;
=C2=A0setbounds currentpicture to=20 boundingbox currentpicture enlarged 2mm;
\stopuseMPgraphic

\def= ineoverlay
=C2=A0 [MyFrame]
=C2=A0 [\useMPgraphic{MyFrame}]

\starttext

\startMyFrame
\input knuth
\stopMyFrame

\startMyFrame
\input knuth
\stopMyFra= me


\startMyFrame[Title=3DHans]
\input knuth
\stopMyFrame

\startMyFrame[Title=3DHagen]
\input knuth
\stopMyFrame

Wolfgang
--------------040908000309050605020708-- --===============5893970131917336917== 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= --===============5893970131917336917==--