Generate a real empty path structure instead of returning
_cairo_path_nil, if we have been asked to create an empty path.
(Also add a couple of missing _cairo_error()s and an appropriate test
case.)
Spotted by Fred Kiefer.
(cherry picked from commit b4f86638cc)
Previously, the TrueType subsetting would fail if any of the "cvt",
"fpgm", or "prep" tables were missing from the source font. However
these tables are optional and not required in the subsetted font if
they do not appear in the source font.
The "name" table has been removed from the subsetted font as the
Type42 specification does not require this table.
(cherry picked from commit b20e08999e)
If atsui and ft were both enabled, the code crashed trying to subset
type-1 fonts; fixed by checking if fonts really are ft before using
them as ft fonts. This is a temporary fix until we support subsetting
across all font backends.
(cherry picked from commit 8132b8b417)
Fix up the _cairo_malloc_* wrappers to avoid blindly dividing by zero;
any attempt to allocate a zero-sized chunk of memory will result in
NULL.
(cherry picked from commit 6020f67f1a)
Same for FT_Render_Glyph.
When the user asks us to render a glyph that is not available in the font,
it's mostly an unavoidable kind of error for them, as in, they can't
avoid such a call. So it's not nice to put cairo_t in an error state and
refuse any further drawying.
Many PDF files are created using buggy software and cause such glpyh-not-found
errors for CID 0 for example.
Eventually we should propagate these kind of errors up and return it from
the function call causing it, but that needs API change to add return value
to all text functions, so for now we just ignore these errors.
(cherry picked from commit 79d975f84b)
Under rare circumstances we may need to extract a surface that
represents a bitmap with width==0 and rows==0. Detect this case at the
start and simply return a zero-sized surface.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12284.
(cherry picked from commit d62f886168)
The optimization that avoids replaying commands prior to an unclipped
CLEAR operation now starts playback from the first command after the
CLEAR. This avoids the need to handle the unclipped CLEAR in the PDF
surface.
(cherry picked from commit 875e32178e)
The PDF surface was adding extra stops at the 0.0 and 1.0 offset when
there was not already stops at these offsets. This has been replaced
with code to move the coordinates of the linear gradient line in to
the position of the first and last offset.
(cherry picked from commit 3216275fd9)
If scaled_font_destroy() is called, a deadlock can result; there's no
reason to call destroy since the initialization failed (and, indeed,
it might not be valid to do so anyway).
(cherry picked from commit 6525d4debb)
This avoids a potential crash from the Render extension being cleaned
up during XCloseDisplay before the cairo CloseDisplay hook goes on to
call into XRenderFreePicture.
(cherry picked from commit 9f4e643649)
As noted in http://bugs.freedesktop.org/show_bug.cgi?id=12026 the error
path of _cairo_ft_unscaled_font_lock_face() failed to reset the
unscaled->lock_count before releasing the mutex and returning NULL.
(cherry picked from commit bc635da45a)
Andrew Jorgensen spotted that make dist was missing a few headers needed
for compilation and running make distcheck had spurious failures. Add
the missing files to the distribution and a silly one-liner to check for
missing reference images.
(cherry picked from commit e5b01e6797)
[With some edits after cherry-picking to elide files that don't exist
in the 1.4 branch.]
This patch introduces three macros: _cairo_malloc_ab,
_cairo_malloc_abc, _cairo_malloc_ab_plus_c and replaces various calls
to malloc(a*b), malloc(a*b*c), and malloc(a*b+c) with them. The macros
return NULL if int overflow would occur during the allocation. See
CODING_STYLE for more information.
(cherry picked from commit 5c7d2d14d7)
This was a tiny piece of cleanup that had been erroneously included
with some earlier functional changes, (so it went through a cycle
of being applied and reverted). It's back now in its own commit.
This reverts commit 285b702ef6.
The recent commit of 0791f342b9 fixes
the same bug that 285b702e was fixing, but without introducing any
performance-killing calls to XSync. So we can drop those now.
This reverts commit 7016614dd9.
We want to avoid any negative performance impacts due to extra calls
to XSync. The fact that X errors can be missed with this appraoch is
undesirable of course---a proper fix will likely involve moving to
XCB which will hopefully allow us to do the error-checking the way
we want without any performance penalty.
This eliminates X errors propagated from cairo due to cleaning up
Render Pictures after the application had already destroyed the
Drawable they reference. (It would be nice if the X server wouldn't
complain that some cleanup work is already done, but there you
have it.)
This fix has been verified to fix the bug causing OpenOffice.org to
crash as described here:
XError on right click menus in OOo.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811
And unlike other proposed fixes for this bug, this fix does not
introduce any new calls to XSync, (and thereby avoids performance
concerns from those).
It is possible for the resources that we defer freeing to be already
destroyed and trigger an XError whilst processing the work queue. For
example, the application renders to a Window and then destroys the
Drawable before proceeding with more rendering. This will trigger an
invalid Picture from RenderFreePicture whilst attempting to free the
resources.
By ignoring the possibility that the application could allocate a fresh
resource with the same ID, we can simply hide the XErrors...
Fixes: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811
Call XSync before ignoring errors from XGetImage to avoid hiding
unassociated errors. Similarly, call XSync before reinstalling the old
error handler to ensure no errors creep out of the ignored section.
When an xlib surface is used as the source of a draw operation this
will cause the contents of child windows to be included in the source
data. The semantics of drawing to xlib surfaces are unchanged (ie:
draws are still clipped by child windows overlapping the destination
window).
[quartz] move glyph array declarations
Move declarations causing a warning. A separate patch from
the other warning cleanups because it moves where the allocation
happens.