Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #2543

Re: setlinecap and moveto: whose bug?

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: setlinecap and moveto: whose bug?
Date 2016-04-26 08:28 +0100
Message-ID <MPG.318928ef3c1dc94e989905@usenet.plus.net> (permalink)
References <575b9db5-0632-4c5f-9bb3-a54a56fd929a@googlegroups.com>

Show all headers | View raw


In article <575b9db5-0632-4c5f-9bb3-a54a56fd929a@googlegroups.com>, 
jdawiseman@gmail.com says...
> 
> Please see the simple PostScript file
> http://www.jdawiseman.com/papers/bugs/20160425_LineCap_bug.ps
> and two output files:
> http://www.jdawiseman.com/papers/bugs/20160425_LineCap_bug_Ghostscript.pdf
> http://www.jdawiseman.com/papers/bugs/20160425_LineCap_bug_Distiller.pdf
> 
> They differ. Which is correct? 

I believe that Distiller is incorrect, and is 'probably' applying an 
incorrect optimisation. Your original code is:

144 72 moveto  144 144 2 copy 72 144 curveto
72 144 moveto  144 144 2 copy 144 72 curveto
StrokeCode

Distiller makes a PDF containing:

q 1 0 0 1 144 72 cm 0 0 m
0 72 0 72 -72 72 c
0 72 0 72 0 0 c
S
Q

Whereas Ghostscript (more accurately the Ghostscript pdfwrite device) 
produces:

1440 720 m
1440 1440 1440 1440 720 1440 c
720 1440 m
1440 1440 1440 1440 1440 720 c
S

(The pdfwrite device works at 720 dpi by default, so just divide all the 
numbers by 10, or remake the file specifying -r72)

The linecap/linejoin styles in both cases are set/reset correctly 
matching the original PostScript, so I haven't bothered to put these 
her, we can treat the 'StrokeCode' as a simple stroke. However.....

Notice that the intermediate 'moveto' has been lost in the Distiller 
produced PDF file, and the two curves have been optimised together by 
altering the current matrix. This has the (surprising, perhaps) effect 
of causing the left end of the path to be a *join* rather than a cap, 
with the result that you get the wrong kind of terminator.

So it looks to me like you've tripped over an unfortunate optimisation 
in Distiller which is invalid in your particular case.



			Ken

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-04-25 15:59 -0700
  Re: setlinecap and moveto: whose bug? Scott Hemphill <hemphill@hemphills.net> - 2016-04-25 19:51 -0400
  Re: setlinecap and moveto: whose bug? ken <ken@spamcop.net> - 2016-04-26 08:28 +0100
    Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-04-26 01:31 -0700
    Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-04-26 02:41 -0700
      Re: setlinecap and moveto: whose bug? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-01 19:55 -0700
        Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-06-02 06:44 -0700
  Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-07-17 14:51 -0700
    Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-07-28 03:01 -0700
      Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2016-10-11 15:23 -0700
        Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2017-05-12 17:25 -0700
          Re: setlinecap and moveto: whose bug? jdaw1 <jdawiseman@gmail.com> - 2018-01-17 15:11 -0800

csiph-web