ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: mptopdf or mpost problem with bounding boxes?
       [not found] <200106081447.PAA22615@skye.ra.phy.cam.ac.uk>
@ 2001-06-09 18:18 ` Hans Hagen
  0 siblings, 0 replies; only message in thread
From: Hans Hagen @ 2001-06-09 18:18 UTC (permalink / raw)
  Cc: ntg-context

At 03:47 PM 6/8/01 +0200, Sanjoy Mahajan wrote:
>Dear Hans,
>
>Here's another problem I noticed, and I'm not sure if it's due to
>pdftex, mptopdf, or mpost.  The tilted ellipse in transfer.pdf (in the
>attached gzipped tar file) is clipped at its top edge (magnify a lot
>in acroread to see the problem).  transfer.pdf comes from transfer.mp
>via "pdftex '&mptopdf' '\relax' transfer.1"  
>
>When `transfer.pdf' is included in a pdftex file -- see `test.tex' and
>`test.pdf' in the tar file -- the clipping means that the ellipse is
>broken open at the top edge.
>
>For comparison I also included `transfer2.pdf' made by `epstopdf', and
>it has a similar problem.  If I change transfer.mp not to spit out
>high-resolution bounding boxes (right now it has prologues:=-1), then
>the problem goes away.  But maybe the underlying bug is still there,
>and the slippage of half a pixel or so is enough to hide it?
>
>Do you see the same problem in your setup?  Perhaps your pdftex is
>newer?  The versions I use (from tetex-1.0.6 in linux 2.0):
>
>- MetaPost 0.641 (Web2C 7.3.1)
>- pdfTeX, Version 3.14159-13d (Web2C 7.3.1)
>- epstopdf 1999/05/06, v2.5
>
>I've simplified the MP file roughly as far as possible yet still
>preserve the bug.
>
>I don't think it's an MP problem, because `test2.tex' (which uses
>regular tex and `epsf.tex' to include the EPS file `transfer.1') looks
>fine when turned into postscript (no clipping).  But maybe the
>bounding box is not okay yet epsf.tex doesn't notice?

Well, i spent many days on this problem already. It's not so much a bug as
well as a combination of 

(1) pdf viewers clipping in an inaccurate way. I already use more digits
precission now, but still, viewers can spoil things especially when xforms
are used. In ConTeXt additional measures are taken.      

(2) the boundingbox of a graphic is calculated using the points that make
up curves, so the extreme lrtb points of a circle are clipped to half the
linewidth. If you have a recent version of context, there is also a file
mp-tool in there. If you load this file, you got a bunch of additional mp
macros. This file also sets the high res boundingbox. One way to deal with
the problem is to say:

input mp-tool ; 

beginfig (1) ; 
 .... 
 setbounds currentpicture to boundingbox currentpicture enlarged 1pt ; % or
whatever
endfig ; 

end

In ConTeXt, when mp graphics are embedded, this is normally not needed.
When using ConTeXt to make independent graphics [see metafun manual at our
site which also covers most of mpost in detail] you can use \startMPpage
cum suis and enlarge the boundigbox of each graphic with \setupMPpage
[offset=1pt] etc etc 

Personally i think that it should be an option for metapost to calculate
the real boundingbox.  

(3) concerning normal versus high res boundingbox: your observation has to
do with rounding and in most cases you're better of with the high res
(better loose .05pt than .5pt). 

(4) In pdf(tex) a mediabox is quite restrictive and forms clip, while in ps
or inline graphics in pdf there is no clipping. So, when you encounter
unwanted clipping, in ConTeXt one can disable form (object) usage, or
enlarge the extra offsets, or ...  

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
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-09 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200106081447.PAA22615@skye.ra.phy.cam.ac.uk>
2001-06-09 18:18 ` mptopdf or mpost problem with bounding boxes? Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).