[cairo] Bug in PDF output with independent path/pen transformations

Carl Worth cworth at cworth.org
Tue Oct 30 21:17:44 PDT 2007


On Tue, 30 Oct 2007 21:58:03 -0400, Behdad Esfahbod wrote:
> I did.  The bug is in how we print doubles out.  We use %f, because
> scientific syntax is not ok in the output.  But then %f is not flexible
> enough and is producing 0.000001 when it should be doing
> 0.000000707106781 or something more like that.  I really wish %g could
> be used.

Thanks for the diagnosis, Behdad. That was a good catch.

> Anyway, I'll cook a patch that should also optimize the way we
> write out numbers a bit.

I'll look forward to that.

> In the mean time, this works:
...
> -    snprintf (buffer, size, "%f", d);
> +    snprintf (buffer, size, "%20.15f", d);

Yes, that does work. And for our PDF files with compressed streams, it
doesn't have a significant impact on the file sizes. But that's pretty
harsh for our uncompressed PostScript output.

Since we do have some patches already in place to help improve PostScript
file output size, I'm not going to change this now before the 1.5.2
snapshot, (nobody has noticed this problem previously as far as I
know).

Then we can get your more proper fix in before 1.6.0.

Meanwhile, Brian, I'd be interested to hear if Behdad's patch helps
the problems you're seeing with Preview. And if not, can you post a
screenshot showing what you're getting?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071030/484a2176/attachment.pgp 


More information about the cairo mailing list