Comment 12 for bug 1250250

Revision history for this message
David Mathog (mathog) wrote : Re: WMF open on linux misplaces drawing

The attached patch replaces the previous one.

As far as I can tell it supports all 4 file open modes, it is still a work around, but it seems to work.

I also hunted down the "round trip" problems discovered while testing and fixed them, those are included in this patch. These were:

1. EMF header fields. These have been modified slightly so that rclBounds is round trip stable. The device size fields were reduced from 100xA4 to just A4. As I vaguely recall the original reason for using the larger device had something to do with increasing the resolution of the original Windows EMF driver version when writing the EMF through the windows library. The larger device doesn't do anything with the libUEMF driver, so the fields can be the more natural A4.

2. The Inkscape::Util::Quantity::convert business broke the output of dashed and dotted lines and I had not noticed. What used to be 3 or 1 are now divided by 3.543307 ( = 90/25.4), stored in an integer, which made them zero. The fix multiplies that factor back in before storing into the integer.

3. The Inkscape::Util::Quantity::convert business caused a problem with worldtransforms used before image writes. These became unstable so that while the Destination for the image was stable, the offset in the transform jumped around by a fraction of a pixel. The fix involves working backwards from the integer Destination coordinates to the floating point transform.

4. Off by 1 values. That seems to have gone away with the workaround. I really do not understand why though.

Will come up with a small test example and post it next.

Because it was scriptable, the round trip testing was pretty thorough using the --export-emf and --export-wmf methods (and the patch from bug #1244749 to enable it). Some manual file->open testing was also done, but since that was all manual, it was only done a few times.