Bug 689562 - Ghostscript's bbox driver gives wrong result
Summary: Ghostscript's bbox driver gives wrong result
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Other Driver (show other bugs)
Version: master
Hardware: All Linux
: P4 normal
Assignee: Marcos H. Woehrmann
URL: https://bugs.launchpad.net/bugs/160203
: 689548 (view as bug list)
Depends on:
Reported: 2007-11-14 06:56 UTC by Till Kamppeter
Modified: 2009-01-05 04:22 UTC (History)
1 user (show)

See Also:
Word Size: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Till Kamppeter 2007-11-14 06:56:31 UTC
See Ubuntu bug report


Ghostscript in Gutsy (and Hardy) gives wrong results for the Bounding Box for
most EPS files I've tried. It used to work fine with gs-gpl in Feisty. One
simple example of the failure is the following (using the example.ps file attached):
   gs -sDEVICE=bbox -dNOPAUSE -dBATCH example.ps
the result is wrong.

Reverting back to a previous version is hard, since the package changed its name
in Gutsy.

Example.ps file's content:
%%Title: example.ps
%%Date: Sat Nov 3 20:58:13 WET 2007
%%BoundingBox: 52 97 267 163
%%Page: 1 1
0.8 0 0 setrgbcolor 1 setlinewidth
100 15 160 {100 exch moveto 120 0 rlineto stroke} for
0 setgray 0.3 setlinewidth newpath
140 130 3 0 360 arc gsave 0.7 0.6 0 setrgbcolor fill grestore stroke
/Times-Italic findfont 12 scalefont setfont
136 138 moveto (q) show
 55 127 moveto (V ) show currentpoint
225 127 moveto (V ) show
/Times-Roman findfont 12 scalefont setfont
(menor) show moveto (maior) show

Here is another PostScript file that shows better the bug. The command "gs
-sDEVICE=bbox -dNOPAUSE -dBATCH example2.ps" gives an empty bounding box, which
is wrong:
GPL Ghostscript SVN PRE-RELEASE 8.61 (2007-08-02)
Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000

The gs-gpl package in Edgy used to give the correct result.

(file example2.ps attached to original bug report)
Comment 1 Marcos H. Woehrmann 2007-11-14 07:25:08 UTC
This is likely a duplicate of Bug 689548 and has been fixed in the current head

We were just discussing yesterday how unfortunate it was that the Ghostscript
version number didn't give revision information (PRE-RELEASE 8.61, isn't
definitive, since that is what the r8165 through r8363 report).

In any case, I'm working on finding a patch for this.
Comment 2 Marcos H. Woehrmann 2007-11-14 07:25:59 UTC
*** Bug 689548 has been marked as a duplicate of this bug. ***
Comment 3 Marcos H. Woehrmann 2007-11-14 08:16:33 UTC
Till, do you know that date or revision of the svn snapshot that was us to build
the Ghostcript that is generating the bad bounding boxes?  I'm having trouble
finding it.
Comment 4 Till Kamppeter 2007-11-14 08:59:12 UTC
Ubuntu ships revision 8187, so that one has definitely the problem. See bug
689548  for whether the original poster observed the bug also in other revisions.
Comment 5 Marcos H. Woehrmann 2007-11-14 11:17:31 UTC
I'm not able to duplicate the bounding box problem with r8187, or any of the
other various revisions that I've tested.  

I thought perhaps that the problem related to the fact that under Ubuntu 7.10
/usr/bin/gs is just a front end for /usr/lib/libgs.so.8.61, but I've tried
building Ghostscript r8187 as a shared object ('make so', after adding
"CFLAGS_SO=-fPIC" to the Makefile) and then running sobin/gsc, but that works as

I suspect it's related to the build process.
Comment 6 Till Kamppeter 2009-01-05 04:22:39 UTC
The bounding box problem has turned out to be caused by the CJK support patches
applied to the Ghostscript in Debian and Ubuntu. After rebuilding without the
patches I get correct results. The patches will be dropped in the Debian and
Ubuntu packages from Ghostscript 8.64 on, as Ghostscript 8.64 provides the CJK
support natively. Ghostscript 8.64 will get released on February 1.