When cairo outputs PostScript it currently creates matrices which are slightly off due to rounding during negation. As an example, this was found in output from evince: /CairoFont-1-0 findfont [ 9.9585 0 0 -9.958399 0 0 ] makefont setfont This patch moves the negation from the C into the PostScript, so the above will become: /CairoFont-1-0 findfont [ 9.9585 0 0 -9.9585 0 0 ] makefont setfont In PostScript, -0 is the same as 0, so (compliant) PostScript interpreters will Do The Right Thing should cairo emit a -0. I’ll attach a patch; it can also be pulled from: git://people.freedesktop.org/~cloos/cairo.git (Incidently, the value 9.9585 above comes from a system that believes there are 72.3 points per inch, as compared to the 72.27 ΤεΧ uses, or the 72.0 PostScript and PDF use. I also saw an instance — though I can’t seem to find it — where an integer turned into a float value: something like 9 and -8.9975 or so.)
Created attachment 11154 [details] [review] Fix negation rounding in generated PostScript. Can also be pulled from: git://people.freedesktop.org/~cloos/cairo.git
I was looking into this a bit more while offline and noticed that the args are doubles. Because ‖-foo‖ ≠ foo I presumed the args were fixed point, but I see from looking at the _cairo_matrix and _cairo_scaled_font structs that they are in fact doubles. Since ‖-double‖ ≡ double, that means there is a rounding bug in whatever code is setting the matrix, since it is taking a single value and storing differently-rounded versions of it in scaled_font->scale.xx and scaled_font->scale.yy. So, I'll delete the patch and will try to determine where the bad rounding occurs.
Comment on attachment 11154 [details] [review] Fix negation rounding in generated PostScript. invalid patch, bug is elsewhere.
As was pointed out comment #2, doubles are used for matrices from the API through to the PostScript backend so the rounding is not caused by cairo.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.