Comment 11 for bug 186182

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

The Bounding box in the EPS file is incorrect. If you edit the file to increase the size of the %%BoundingBox and %%PageBoundingBox comments the miters are not clipped. Viewing the file directly with ghostscript also works since it is gv/evince/Preview that is interpreting the DSC comments, not gs.

The bounding boxes in the EPS file are generated by cairo so initially this did look like a cairo bug. But the bounding box is never larger than the page size so if Inkscape sets the cairo PostScript page size too small when creating the EPS file the bounding box will be too small. Looking at the PDF output this appears to be exactly what is happening.

There is a another problem. The triangle is positioned to far to the bottom left resulting in the bottom left being clipped because it is off the page. This is the fault of Inkscape. It looks like Inkscape is trying to position the bottom left of the triangle at (0,0) but incorrectly calculates the extents of the triangle.

Moving the drawing to (0,0) is not necessary in EPS files. The bounding box DSC comment specifies the lower left and upper right corners of the bounding box so that the application importing the EPS can correctly position the drawing.

The solution for EPS output is for Inkscape to avoid trying to set the page size to the drawing extents or moving the drawing to (0,0). Cairo will set the correct bbox and it will all just work.

For PDF, cairo does not currently calculate or provide any way to specify the bounding box so I can understand why Inkscape would want to move the drawing to (0,0) and limit the page size to the bounding box to ensure the PDF can be correctly imported into other applications. The problem is Inkscape is incorrectly calculating the drawing extents resulting in the bbox too small and the drawing incorrectly positioning. This problem is the same bug as 166659.

Cairo has a new function that will help with calculating bounding boxes - cairo_meta_surface_ink_extents(). But this is not yet in any stable release. It should be in 1.10 when it is released.