[gl2ps] bugs in BBox for EPS files?

antoine rouhan antoine.rouhan at gmail.com
Wed Nov 15 10:58:47 CET 2006


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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gl2ps/attachments/20061115/bd1e1033/attachment.html>