[cairo] Changing %f to %g in cairo-output-stream.c?

Adrian Johnson ajohnson at redneon.com
Fri Oct 20 05:05:05 PDT 2006


Behdad Esfahbod wrote:
> Hi,
> 
> While working on Pango Postscript output from Firefox I noticed that we
> are using %f to print double values in cairo-output-stream.c.  Shouldn't
> we be using %g instead?  The difference is that %g generates a shorter
> representation than %f.  For example, printing 0.3, %g will print 0.3,
> while %f prints 0.30000.

cairo-output-stream.c reimplements printf to provide formatting of
doubles that is independent of the current locale's decimal separator.
The reimplementation only takes %f and always trims trailing zeros.


More information about the cairo mailing list