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

Behdad Esfahbod behdad at behdad.org
Wed Oct 31 12:52:49 PDT 2007


On Tue, 2007-10-30 at 21:17 -0700, Carl Worth wrote:
> 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. 

So, I pushed %.18f and then Adrian made it smarter by using %f if number
is > 0.1 and otherwise %.18f, then prune it to have only 6 meaningful
digits.

I suggest we refine it further:

  - 18 digits is still not enough to write a number like 7e-100.  What
we really want is up to a large number of digits (100?), but only 5 6
meaningful digits.  How many and how many exactly?  For implementing it,
we can either write a loop of some kind or use more expensive operations
like ickle is showing me:

	http://rafb.net/p/OQ9e7495.html


  - Those are useful for writing out matrices, and we can't get much
better at them.  But for path coordinates we can do better, namely, use
tolerance.  If tolerance is 0.1, we need not more than two digits after
decimal point.  However, we should scale tolerance exactly like in my
recent mail about scaled-tolerance in meta-surface.

/me waits for ickle to chip in his part in this bug :-P

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list