[gl2ps] bugs in BBox for EPS files?

Christophe Geuzaine christophe.geuzaine at case.edu
Thu Nov 16 14:47:39 CET 2006


antoine rouhan wrote:
> Hi Christophe,
>  When using gl2ps, with the following options on the command line:
> 
> state=gl2psBeginPage(filename,"toto",viewport,GL2PS_EPS,GL2PS_BSP_SORT,GL2PS_USE_CURRENT_VIEWPORT|GL2PS_LANDSCAPE 
> |GL2PS_SIMPLE_LINE_OFFSET |GL2PS_BEST_ROOT |GL2PS_TIGHT_BOUNDING_BOX, 
> GL_RGBA,0,NULL,0,0,0,buffesize,fp,filename);
> 
> Then I got wrong bounding boxes in the  EPS file.
> I changed it manualy inside the EPS file.
> Taking an original (wrong BBx) EPS file:
> %%BoundingBox: 466 268 815 667


Hello Antoine - I think the problem comes from the fact that you are 
using the GL2PS_TIGHT_BOUNDING_BOX option: with this option, we 
disregard the original bounding box and we compute a new one that 
encloses the primitives as tightly as we can. Just removing that option 
should give you what you want.

Christophe


> 
> and changed to
> %%BoundingBox: 0 268 (815-466) 667   (466->0 815 -> 815-466)
>  lead to
> %%BoundingBox: 0 268 349 667
> which is the correct bounding bbox (I got good reuslts using ghostview, 
> including eps files in latex etc.)
> 
> So I Propose the following modification in the gl2ps.c source file:
> 
>   gl2psPrintf("%%%%BoundingBox: %d %d %d %d\n"
>               "%%%%EndComments\n",
>               (gl2ps->options & GL2PS_LANDSCAPE) ?          
> 0                                      : (int)gl2ps->viewport[0],
>               (gl2ps->options & GL2PS_LANDSCAPE) ? 
> (int)gl2ps->viewport[0]                         : (int)gl2ps->viewport[1],
>               (gl2ps->options & GL2PS_LANDSCAPE) ? 
> (int)gl2ps->viewport[3]-(int)gl2ps->viewport[1] :  (int)gl2ps->viewport[2],
>           (gl2ps->options & GL2PS_LANDSCAPE) ? 
> (int)gl2ps->viewport[2]                         : (int)gl2ps->viewport[3]);
> 
> 
> cheers,
> Antoine
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gl2ps mailing list
> gl2ps at geuz.org
> http://www.geuz.org/mailman/listinfo/gl2ps


-- 
Christophe Geuzaine
Assistant Professor, Case Western Reserve University, Mathematics
http://www.case.edu/artsci/math/geuzaine