View Issue Details

IDProjectCategoryView StatusLast Update
0000881MetaPostbugpublic2014-01-24 13:05
Reporterpiotrst Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Status newResolutionopen 
PlatformPCOSLinux and Windows 
Product Version1.780 
Summary0000881: Incorrect MPOST output in degenerated closed path case
DescriptionClosed degenerated MPOST path:

beginfig(1)
 draw (0,0)--(0,0) & cycle withpen pencircle scaled 1;
endfig;
bye.

yields a strange and `too simple' result:

%!PS
%%BoundingBox: -1 -1 1 1
%% ...
0 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth
pop [] 0 setdash 1 setlinejoin 10 setmiterlimit
newpath 0 0 moveto
closepath stroke
showpage

which is incorrectly displayed in both Ghostscript and Adobe Reader.
Steps To ReproduceSecond, let's consider another degenerated case, not covered
by Hans's amendment:

  beginfig(1)
   draw (0,0)--(0,0) withpen pencircle scaled 1;
  endfig;
  bye.

The output PostScript code reads (most of comments skipped):

  %!PS
  %%BoundingBox: -1 -1 1 1
  %% ...
  0 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth
  pop [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit
  newpath 0 0 moveto
  0 0 lineto stroke
  showpage

Ghostscript happily displays the correct, i.e., expected result (Adobe Reader also, after the distillation, of course).

A slight modification of the degenerated case:

  beginfig(1)
   draw (0,0)--(0,0) & cycle withpen pencircle scaled 1;
  endfig;
  bye.

yields a slightly modified result:

  %!PS
  %%BoundingBox: -1 -1 1 1
  %% ...
  0 0 0 setrgbcolor 0 1 dtransform truncate idtransform setlinewidth
  pop [] 0 setdash 1 setlinejoin 10 setmiterlimit
  newpath 0 0 moveto
  closepath stroke
  showpage

Now, Gostscript displays nothing, and the respective PDF file
does not contain a visible object according to Adobe Reader.

The culprit is, somewhat surprisingly, the phrase "1 setlinecap",
missing from the PostScript code in the latter case. (Observe
that "1 setlinejoin" does not help.)
 
Additional Information
So, we would advise that the phrase "1 setlinecap" should be
issued in degenerated cases (at least), to avoid admittedly
rare but surprising results.

Perhaps advisable would be replacing the phrase "0 0 moveto" by "0 0 moveto 0 0 rlineto", but we're not sure.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2014-01-24 13:05 piotrst New Issue