From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/11251 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: MetaFun questions Date: Fri, 07 Mar 2003 11:21:33 +0100 Sender: ntg-context-admin@ntg.nl Message-ID: <5.1.0.14.1.20030307104325.028ad398@server-1> References: <5.1.0.14.1.20030306141040.0248d6b0@server-1> <5.1.0.14.1.20030228084212.02435940@server-1> <5.1.0.14.1.20030306141040.0248d6b0@server-1> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Trace: main.gmane.org 1047032819 32264 80.91.224.249 (7 Mar 2003 10:26:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 7 Mar 2003 10:26:59 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Fri Mar 07 11:26:58 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18rF46-0008OG-00 for ; Fri, 07 Mar 2003 11:26:58 +0100 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 933BC10B16; Fri, 7 Mar 2003 11:27:30 +0100 (MET) Original-Received: from mail.solcon.nl (mail.solcon.nl [212.45.33.11]) by ref.ntg.nl (Postfix) with ESMTP id 8577B10AFF for ; Fri, 7 Mar 2003 11:21:39 +0100 (MET) Original-Received: from server-1.pragma-net.nl (wc-58016.solcon.nl [212.45.58.16]) by mail.solcon.nl (8.12.5/pre1.0-MySQL/8.12.5) with ESMTP id h27ALZJA015886 for ; Fri, 7 Mar 2003 11:21:35 +0100 Original-Received: from LAPTOP-3.wxs.nl (laptop-3 [10.100.1.191]) by server-1.pragma-net.nl (8.12.3/8.12.2) with ESMTP id h27ALaaa027683 for ; Fri, 7 Mar 2003 11:21:36 +0100 X-Sender: hagen-mail@server-1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Original-To: ntg-context@ntg.nl In-Reply-To: <20030306181611.04128fd5.morawski@gmx.net> X-RAVMilter-Version: 8.4.1(snapshot 20020919) (mail.solcon.nl) Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:11251 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:11251 At 06:16 PM 3/6/2003 +0100, you wrote: > > xysized(\MyFigWid,\MyFigHei) > >ahh, interesting. A plain metapost way as described in my other mail >would be possible if i could run pdftex after the mpost run and run >afterwards mpost again. >How this could be done? Currently we're making a bunch of tools that deal with graphics (a part of the example framework). It's not that hard to provide a mechanism that will write a file with data which is acceptable for metapost. anyhow, here's a solution: In cont-new.tex, add: \def\showexternalfigured {\bgroup \immediate\openout\scratchwrite=mpfigs.mp \def\presetfigure[##1][##2]% {\getfiguredimensionsonly[##1]% \pagefigure[##1]% \immediate\write\scratchwrite {registerfigure("##1",\figurewidth,\figureheight)}} \pushendofline \readjobfile\@@exfile\donothing\donothing \popendofline \immediate\closeout\scratchwrite \egroup} in texexec.pl, patch: [abc] into [abcd] now you can run (in advance!): texexec *.png --pdf --fig=d and get a file mpfigs.mp copy the following code to mp-figs.mp: pair figuredimensions[]; string figurenames[] ; numeric noffigures ; noffigures := 0 ; def registerfigure(expr name,width,height) = noffigures := noffigures + 1 ; figurenames[noffigures] := name ; figuredimensions[noffigures] := (width,height) ; enddef ; vardef figuredimensions(expr name) = save ok, i ; boolean ok ; numeric i ; i := 0 ; ok := false ; forever : i := i + 1 ; ok := (name = figurenames[i]) ; exitif ok ; endfor ; if ok : figuredimensions[i] else : origin fi enddef ; vardef figurewidth(expr name) = xpart figuredimensions(name) enddef ; vardef figureheight(expr name) = ypart figuredimensions(name) enddef ; end and now you can say: input mp-figs.mp ; input mpfigs.mp ; and voila: figurewidth("yourfig") returns the width of the graphic so: just one run in advance is needed [just for testing; i'll think this over before i freeze/add it to context] Hans Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------