CLI eps export of blank svg should succeed (and be consistent with GUI eps export)
migrated from https://bugs.launchpad.net/inkscape/+bug/882167 .
Steps to reproduce:
- Download 882167-nil-closed.svg
inkscape --export-type=eps 882167-nil-closed.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="0" height="0">
<metadata>M0x0</metadata>
</svg>
Note: having width="100" height="100"
, or no width/height also fails similarly (as you might expect since the svg has no objects)
What happened?
- Export fails (and 0 byte file generated)
** Message: 01:50:26.377: CairoRenderer: empty bounding box.
Failed to save PS/EPS/PDF to: 882167-nil-closed_widthed.eps
Original issue
Original report had CLI export create a file with negative values in bounding box %%BoundingBox: 0 -2147483648 0 -2147483648
. This is rather odd.
For reference, Alan Post (OP) shared comments from Tom Rokicki (author and maintainer of epsf.tex):
"The four arguments of the bounding box comment correspond to the lower- left (llx, lly) and upper-right (urx, ury) corners of the bounding box. They are expressed in the default PostScript coordinate system.
[...]
A bounding box of "%%BoundingBox: 0 -2147483648 0 -2147483648" is a negative-space box, and cannot be printed or included in a file as a result. You might have noticed that 2147483648 is 0x80000000, and I wonder if what we're seeing is truncation, rounding error, or overflow.
Tom made the case to me that such "broken" .eps files should not be properly handled, though he is willing to continue the discussion should I present a compelling case.
What should have happened?
- Export should match the export from GUI
- presumably the export should succeed (if it has tight bounds, I assume some eps with bounding box is set to 0 should be valid? tangentially related #2205)
Sample attachments:
- 882167-nil-closed.svg from above
- 882167-nil-closed.eps from GUI export
Version info
- Inkscape 1.2-dev (3495c164d6, 2022-01-17) Linux Mint 20
- Inkscape 0.48.0 r9654 (Feb 17 2011) OpenBSD 4.9