Bug 700958 - bbox device returning different values
Summary: bbox device returning different values
Status: RESOLVED DUPLICATE of bug 700952
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Font API (show other bugs)
Version: master
Hardware: PC Windows 7
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-09 02:25 UTC by evan.cooch
Modified: 2019-04-10 13:24 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
MWE (184 bytes, text/plain)
2019-04-09 02:48 UTC, evan.cooch
Details
.bat file executing GS commands... (230 bytes, text/plain)
2019-04-09 02:49 UTC, evan.cooch
Details
PDF of MWE (32.06 KB, application/pdf)
2019-04-09 11:03 UTC, evan.cooch
Details
PNG file using bbox generatred using gs9.27 (25.15 KB, image/png)
2019-04-09 11:13 UTC, evan.cooch
Details
DVI from MWE (480 bytes, application/x-dvi)
2019-04-09 11:16 UTC, evan.cooch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description evan.cooch 2019-04-09 02:25:25 UTC
Take the following MWE LaTeX source file:

\documentclass{article}
\usepackage{amsmath}
\pagestyle{empty}
\begin{document}

\begin{equation*}
\frac{dN}{dt}=rN\left(1-\frac{N}{K}\right)
\end{equation*}


\end{document}

The equation has both left and right parentheses. However, when running through a series of commands to generate a .png image of the equation, GS 9.27 fails to render the right-most parenthesis. I confirm that current GS is the problem because if I roll back to (say) GS 9.22, no problem. 

Here is the sequence of commands that generate the problem:

1\ generate PDF from MWE.tex file

"pdflatex" -shell-escape -interaction=batchmode "mwe.tex"

--> generates the .pdf files as expected, looking as it should. 

2\ get bounding box for equation (I want image for equation only)

cmd /C "C:\Program Files\gs\gs9.xx\bin\gswin64c.exe" -q -dBATCH -dNOPAUSE -sDEVICE=bbox mwe.pdf 2> mwe.bbx

--> this step works perfectly

3\ 

"C:\Program Files\gs\gs9.xx\bin\gswin64c.exe" -q -dBATCH -dNOPAUSE -sDEVICE=pngalpha -r1200 -sOutputFile="mwe_tmp.png" -g1426x397 -c "<</Install {-262.379101 -632.411981 translate}>> setpagedevice" -f "c:\temp\mwe.pdf"

--> this is the step that fails, if I use gs9.27. The .pnf file generate is missing the right-most parenthesis. 

If I use gs9.22, works fine. 9.27 fails. Not sure where between 9.22 -> 9.27 things 'break', but something is definitely broken.
Comment 1 evan.cooch 2019-04-09 02:48:38 UTC
Created attachment 17310 [details]
MWE

The MWE referred to in bug report.
Comment 2 evan.cooch 2019-04-09 02:49:37 UTC
Created attachment 17311 [details]
.bat file executing GS commands...

/bat file to execute commands to generate bbox for equation in MWE.
Comment 3 evan.cooch 2019-04-09 02:59:24 UTC
Just rolled back through gs9.27 -> 9.25. The bug emerges between gs9.26 and  gs9.27.

Here are the bbox numbers for

9.25

%%BoundingBox: 262 632 348 657
%%HiResBoundingBox: 262.379101 632.411981 347.957989 656.243980

9.26 

%%BoundingBox: 262 632 348 657
%%HiResBoundingBox: 262.379101 632.411981 347.957989 656.243980

9.27

%%BoundingBox: 258 629 343 676
%%HiResBoundingBox: 258.047992 629.171981 342.431990 675.539979


So, you can se the way gs9.27 is handling/calculating the bbox is different 9broken), relative to earlier releases. 

I'm only seeing this for a simple problem, but my guess is this ha all sorts of ramifications for other things using pdflatex.
Comment 4 Chris Liddell (chrisl) 2019-04-09 05:58:53 UTC
Please attach a Postscript or PDF file that illustrates the problem.
Comment 5 Ken Sharp 2019-04-09 07:31:39 UTC
Tis clearly isn't anythign to do with images. Most likely its a change in the bbox device but I'll categorise it as PDF interpreter for now.
Comment 6 evan.cooch 2019-04-09 11:03:12 UTC
Created attachment 17313 [details]
PDF of MWE

As requested - PDF of the MWE as described in original report.
Comment 7 evan.cooch 2019-04-09 11:13:05 UTC
Created attachment 17314 [details]
PNG file using bbox generatred using gs9.27

PNG showing right-truncation of equaition, because bbox generated by 9.27 is 'shifted left (and up, although it doesn't show the latter here), relative to 9.26, 9.25,...
Comment 8 evan.cooch 2019-04-09 11:16:12 UTC
Created attachment 17315 [details]
DVI from MWE

If instead of pdflatex, I use latex - DVI, I generate the attached .dvi file. If I then use

"dvipng" -q -D 1200 -T tight -bg Transparent -o "mwe_latex-dvi.png" "mwe_latex-dvi.dvi"

the PNG file is generated perfectly. Problem only arises is someone is using pdflatex -- and gs9.26 -- to get there from here.  pdflatex works fine with all earlier versions of gs (that I tried, at least).
Comment 9 Ken Sharp 2019-04-09 12:31:43 UTC
I'm afraid bisecting reveals this infamous commit as the source of the problem:

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=355434f4b1bbe8c4f98cafad5a6868aa2f0eaae1
Comment 10 evan.cooch 2019-04-09 12:39:39 UTC
(In reply to evan.cooch from comment #8)
> Created attachment 17315 [details]
> DVI from MWE
> 
> If instead of pdflatex, I use latex - DVI, I generate the attached .dvi
> file. If I then use
> 
> "dvipng" -q -D 1200 -T tight -bg Transparent -o "mwe_latex-dvi.png"
> "mwe_latex-dvi.dvi"
> 
> the PNG file is generated perfectly. Problem only arises is someone is using
> pdflatex -- and gs9.26 -- to get there from here.  pdflatex works fine with
> all earlier versions of gs (that I tried, at least).

I meant.. "Problem only arises is someone is using pdflatex -- and gs9.27 -- to get there from here.  pdflatex works fine with all earlier versions of gs (that I tried, at least)."   gs9.26 works fine regardless of how the .PDF is compiled (latex or pdflatex).
Comment 11 Chris Liddell (chrisl) 2019-04-10 13:24:49 UTC

*** This bug has been marked as a duplicate of bug 700952 ***