We write floats using %f as the scientific format used by smarter %g is
invalid in PS/PDF. %f however by default rounds to five digits after
decimal point. This was causing precision loss and making the newly
added degenerate-pen test fail for PDF. We now print up to 18 digits
which is as many bits doubles can accomodate. We can be smarter, but
that's for another commit.
Otherwise, these don't get included in the generated tar file
and the test suite doesn't pass when run from that tar file,
(like 'make distcheck' tests).
When the current font size matches one of the available fixed sizes, and
the overall transform has only scaling components, FreeType will use the
fixed size bitmaps by default. For glyphs which do not have bitmaps,
force them to be rendered in monochrome instead of anti-aliased so
that they all match nicely.
Instead we choose either the first or last pen vertex as
appropriate.
This makes the degenerate-pen pass stop failing on an
assertion, and passes for most backends. It's still failing
for the PDF backend, but that looks like a new, PDF-specific
bug.
The previous commit failed to fix up two callers to the
_cairo_path_fixed_get_current_point function, (and since
C doesn't distinguish between an enum and our integer-as-
Boolean, the compiler didn't complain).
Fortunately, though, the test suite did complain, as the
bug introduced a new failure into the get-path-extents
test, and git-bisect helpfully pointed to the previous
commit.
With this fix, the new failure of get-path-extents is
eliminated, (though, in this branch the arc-based failure
of that test still exists).
This fixes the current failure get-path-extents, which is a
demonstration of the following bug:
cairo_stroke_extents() gives wrong result for arcs in some cases
https://bugs.freedesktop.org/show_bug.cgi?id=7245
Many thanks to Michael Urman whose review of early versions of
this work found a fatal mistake in my algebra.
If we have already returned the error status, then it is cleaner (and
the common idiom) to use 'return CAIRO_STATUS_SUCCESS' rather than
'return status'.
The only caller of cairo_path_fixed_get_current_point(), used the status
return to determine whether or not the path had a current point (and did
not propagate the error) - for which we had already removed the
_cairo_error() markup. Now we reduce the boolean status return to a
cairo_bool_t, with a net reduction in code.
Adrian Johnson hit a SEGV after
_cairo_paginaged_surface_create_image_surface() tried to set the font
options on an error surface after running out of memory. So add the
usual checks that the surface is not a snapshot, or in an error state or
finished before modifying its font options.
Missed calling _cairo_error() for the CAIRO_STATUS_NULL_POINTER
returned by _cairo_gstate_init(). Rearrange the code to avoid the
overly complicated return statement. We note that _cairo_gstate_init()
is special as _cairo_gstate_fini() will always be called, even if an
error is thrown, and so do not do the usual cleanup in the case of an
aborted initialization.
Bill Spitzak said
"If you really want to match when the determinant is non-zero in the
resulting matrix, use sx*sy != 0. This appears the same as sx&&sy but
may also catch when underflow makes the determinant zero."
Return CAIRO_STATUS_INVALID_MATRIX if we know the user input will
generate a degenerate matrix. For additional paranoia we could recompute
and validate the inverse each time as well.
Testing win32-printing requires setting the default printer to
a PostScript level 3 color printer. The PostScript output is
saved to a file and converted to png using ghostscript.
The win32 CTM is changed to user space to set the stroke parameters.
As win32 uses integers for stroke parameters this will cause rounding
problems depending on the CTM used.
This is fixed by factoring out a scale from the user space CTM so that
xx, xy, yx, and yy in the CTM are all < 1. This preserves the shape
of the transformation while ensuring that the CTM does not cause
rounding problems. The stroke parameters are multiplied by the scale
value.
When using meta surface patterns, the win32 CTM is changed to the
inverted pattern matrix then the meta surface is replayed to the
surface. The problem with this is that win32 uses integer coordinates
for GDI functions. A pattern matrix that scale the CTM up will cause
rounding errors in the position of each path in the pattern.
This is fixed by always keeping the win32 CTM set to the identity
matrix. The CTM is stored in the surface and all coordinates are
transformed by the CTM before calling GDI functions.
This implements clipping using CGContextClipToMask, which
means that it will only have an effect on OS X 10.4+.
No additional tests pass with this fix - mainly due to
text effects and problems with the IN, OUT, DEST_IN, DEST_ATOP
operators.
Quartz was failing the dash-zero-length test for odd numbers
of dashes; it seems cairo wants 3 dashes to be on-off-on,
off-on-off, wheras quartz uses on-off-on, on-off-on. Fixed
by doubling the number of dashes used.