Tim,

I've done some more experimentation and can now give a better
description of the problem. I have attached a test-case, which hopefully
won't be removed by the list. (fingers crossed!)

> the problem seems to be that programs that use EPS output...  pick up
> the bounding box from the PostScript file header, which  is not
> related to the bounding box.

I've been playing around with changing the BoundingBox and
PageBoundingBox by hand (ie text editor) and find that `latex && dvipdf`
between them don't appear to pay much attention to the bounding box or
pageboundingbox. I haven't managed to crop the image by reducing them and
I can't make it move around by changing the left-most limit of either
bounding box. It seems that somewhere along the lines the bounding box
is re-calculated, which isn't going to help with the text alignment. A
white background on a white page doesn't help with this either! 

> The code at files.c line 6292 makes a call to routine "checkforbbox"
> that returns a bounding box record if a bounding box rectangle exists
> on the page.  This sets the scale and position of everything on the
> page, but it doesn't affect the "PageBoundingBox" dimensions (output
> a few dozen lines below it).  It should be simple enough to pass the
> framebox dimensions to the output for PageBoundingBox.

I am a little confused by this description. The PageBoundingBox entry
only appears to exist in the files if a bounding box rectangle exists;
most files only contain the BoundingBox entry. Are neither of these
affected by the bounding box rectangle?

On to the attached test case. I've included a Makefile so it should be
easy to generate a pdf of all of this.

I have created 4 simple diagrams and included them in a latex document.
 1. Automatically created bounding box with no latex text
 2. Automatically created bounding box with latex text. This figure ends
    up off-centre because the original latex string is wider than the
    square. (This is the original problem I found and am trying to work
    around by setting the bounding box manually)
 3. Manual bounding box with no latex text
 4. Manual bounding box with latex text. In this case the figure ends up
    centred but the latex text is in the wrong place. The
    PageBoundingBox width and the latex parbox are of equivalent width
    (wider than fig 3.) but it looks like the tex and eps files are
    using a different origin.

I would expect one of BoundingBox or PageBoundingBox to be the same in
Fig3 as Fig4 as they include the same bounding box rectangle. Figure 4
is wider than figure 3 according to both PageBoundingBox and
BoundingBox.

The final figure (Fig 5) appears to do what I want: the box is centred
and the text is in the right place. To do this I have had to edit both
the bbox-test-byhand.eps and bbox-test-byhand.tex. I had to adjust the
translation in the eps to match that of the no-latex-string version 
(fig 3) ie
  %%PageBoundingBox: 119.25 72 369.75 228
  /pgsave save def bop
  1.0000 inchscale
  2.6000 setlinewidth 896 -128 translate
                      ^^^
And I had to adjust the width of the parbox in the tex file to be the
width of the pageboundingbox from  fig 3 ie (228-72)/72=2.16667in

These changes might affect other programs which do honour the
boundingbox attributes. Looking at the eps with gv, there is still more
white space than I expect but the figure is now aligned to the left with
all the extra white space on the right.

I haven't picked through the code to work out the significance of
all this yet.

John

This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev

Reply via email to