Commit graph

3790 commits

Author SHA1 Message Date
Jeff Muizelaar
7a5f7b4a4b Fix compilation on OS X when compiling for 64 bit
OS X doesn't support ATSUI in 64 bit so don't include the cairo ATSUI
API in that case.
2009-06-16 11:48:54 +01:00
Chris Wilson
c21a9eecb0 [win32-font] Non-fatal error from GetGlyphOutlineW(GGO_METRICS)
If GetGlyphOutlineW(GGO_METRICS) fails to retreive the metrics for the
specified glyph it returns GDI_ERROR. Like ft, do not interpret this as a
fatal error but just mark the glyph as empty.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20255
Bug 20255 -- cairo_scaled_font_glyph_extents breaks with invalid glyph id
2009-06-10 13:05:18 +01:00
Chris Wilson
2fd0beab2a [ft] Don't call FT_Done_Face() on a face we do not own
_font_map_release_face_lock_held() was being called unconditionally during
_cairo_ft_font_reset_static_data(). This presents two problems. The first
is that we call FT_Done_Face() on an object not owned by cairo, and the
second is that the bookkeeping is then incorrect which will trigger an
assert later.
2009-06-06 16:17:03 +01:00
Chris Wilson
018275c953 [pattern] Typo in document
Remove extraneous markup from program-listing.

https://bugs.freedesktop.org/show_bug.cgi?id=20441
2009-06-03 20:19:24 +01:00
Chris Wilson
ee90a33169 [cairo] Doc typo.
Fix conflicting sentence as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20183
2009-06-03 10:53:10 +01:00
Chris Wilson
bf6e306013 [image] Doc typo.
Correct parameter reference as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20182
2009-06-03 10:53:01 +01:00
Chris Wilson
234b2d077c [font-options] Doc typo
Remove duplicate 'with' as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20180
2009-06-03 10:52:48 +01:00
Chris Wilson
cbdccac88b [cairo] Update documentation for bug 20154
Several typographical errors were pointed out in
https://bugs.freedesktop.org/show_bug.cgi?id=20154
2009-06-03 10:39:33 +01:00
Adrian Johnson
a278c1bea9 Ensure win32 font index_to_ucs4() sets ucs4 to -1 if lookup fails 2009-06-03 10:22:45 +01:00
Karl Tomlinson
c8f4b2fe80 [ft] Resolve mutual referencing problems with zombie faces
Bug 21706 -- zombie ft_font_face / ft_unscaled_font mutual
             referencing problems
[http://bugs.freedesktop.org/show_bug.cgi?id=21706]

There can be more than one zombie font_face belonging to an unscaled_font,
but only the first is destroyed.  This leaks the client's FT_Face
(and associated font data) as release of the FT_Face depends on release
of the font_face.

(The reason why Firefox ends up with two different font_faces for one
unscaled_font is that load_flags for faces with artificial oblique have
FT_LOAD_NO_BITMAP set.
https://bugzilla.mozilla.org/show_bug.cgi?id=486974)

Also it's possible for _cairo_ft_font_face_create to pull out a zombie
font_face from the unscaled_font, which would crash
_cairo_ft_font_face_scaled_font_create, as that expects non-null
font_face->unscaled (if !font-face->pattern).
2009-06-03 07:17:10 +01:00
Behdad Esfahbod
634298af13 [ft] Fix vertical advance metrics of bitmap fonts (#21985) 2009-06-03 07:16:58 +01:00
Chris Wilson
de7270cb1e [cairo] Describe the restrictions upon cairo_set_tolerance()
Truc Troung reported that the behaviour of
cairo_set_tolerance()/cairo_get_tolerance() was inconsistent with the
documentation, i.e. we failed to mention that the tolerance would be
restricted to the smalled fixed-point value.

Add a sentence to the documentation that describes the restriction without
mentioning what that is... Hopefully that is sufficient detail to
accommodate the reporter, without exposing internal implementation details.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=20095
Bug 20095 - The cairo_set_tolerance() function behavior is inconsistency
with the spec
2009-02-13 10:07:37 +00:00
Chris Wilson
e7d4bc3d86 [png] Correct documentation to avoid reference to NULL
As pointed out by Truc Truong,
cairo_image_surface_create_from_png_stream() cannot return NULL and so the
documentation was incorrect.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20075
Bug 20075 There is a misprint in the spec for
cairo_image_surface_create_from_png_stream() function
2009-02-12 10:42:24 +00:00
M Joonas Pihlaja
a5c1cdf2b0 [clip] Fix uninitialised status return in _cairo_clip_intersect_mask() for empty extents.
This fixes the clip-all test case crashing for me.
2009-01-05 14:19:42 +00:00
Jeff Muizelaar
f60da9a379 Fix _compute_transform to check for nearly degenerate matrices
If a matrix was something like [0 .000001 0, .000001 0 0] the old code would
assume that xx and yy were greater than 0 and turn the nearly degenerate matrix
into an actual degenerate one. This caused things to blow up later on. Now we
check that our nearly rectangular matrices are not nearly degenerate, and let
the nearly degenerate ones fall through to the non-rectangular path.

Note: I'm not sure why NEARLY_ZERO(d) is fabs(d) < 1/65536 instead of some
other value.  Hopefully, it's a useful definition.

This problem was found by a test case attached to:
https://bugzilla.mozilla.org/show_bug.cgi?id=467423
2008-12-18 17:07:25 -05:00
Karl Tomlinson
0137b9bd32 [ft] Don't call FT_Done_Face() on faces we did not create 2008-12-17 16:42:20 -05:00
Chris Wilson
b1be419651 [doc] Fix erroneous doc comment.
A normal comment was marked as a gtk-doc entry and thus causing gtk-doc to
complain.
2008-12-14 11:26:56 +00:00
Julien Danjou
97b5240bee [xcb] check for render extension presence
Otherwise this may leads to an invalid memory access to r.

Fixes: Bug 18588 - XCB backend fails with missing render.
https://bugs.freedesktop.org/show_bug.cgi?id=18588

Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 834f1d7b70)
2008-12-14 11:01:41 +00:00
Chris Wilson
6fed98c0d3 [gstate] Remove culled glyphs from clusters.
Sascha Steinbiss reported a bug where the PDF backend was reading beyond
the end of the glyph array:
http://lists.cairographics.org/archives/cairo/2008-December/015976.html.

It transpires that in the early glyph culling in the gstate we were
not updating the clusters to skip culled glyphs.
2008-12-14 10:54:42 +00:00
Jeff Muizelaar
d93bf10edc [quartz] Create a copy of the pattern so that the reference counts are balanced
The pattern could be stack allocated so we can't take a reference to it;
instead make a copy.

Based on a patch by Paolo Bonzini.
2008-12-10 17:41:45 -05:00
Jeff Muizelaar
673640a3b3 [win32] Use MOD instead of the '%' operator
Repeat should be handled using MOD instead of '%' so that negative numbers
are handled as expected. E.g. -1 mod 600 = 599, not 495 as the '%' operator
gives. This was causing https://bugzilla.mozilla.org/show_bug.cgi?id=466258

Patch from Robert O'Callahan
2008-12-08 11:37:38 -05:00
Chris Wilson
540de34453 [matrix] Optimise invert for simple scaling|translation matrices.
Peter Hercek reported, and provided a very useful test case for, a bug
that caused his applications to crash with Cairo detecting an
non-invertible pattern matrix and thus asserting the impossible happened.
Bisecting revealed that the bug first appeared with 3c18d95 and
disappeared with 0d0c6a1. Since neither of these explain the crash,
further investigation revealed a compiler bug (gcc 4.3.3 20081130,
earlier versions have different bugs!) that caused the matrix inversion
to be invalid iff _cairo_matrix_scalar_multiply() was inlined (i.e. -O0,
or an explicit noinline atttribute on that function prevented the bug, as
did -msse.) So we apply this workaround to hide the bug in the stable
series...

The matrix is quite often just a simple scale and translate (or even
identity!). For this class of matrix, we can skip the full adjoint
rearrangement and determinant calculation and just compute the inverse
directly.
(cherry picked from commit 0d0c6a199c)
2008-12-02 17:31:51 +00:00
Chris Wilson
f5634818f1 [os2] Move include cairo.h before os2.h
The defines need to come first, but we specify that cairo.h is the first
header file to be included by files.
2008-11-26 20:23:05 +00:00
Behdad Esfahbod
2f0f9a1a59 [os2] Fix includes
Patch from Dave Yeo to make cairo-os2.h include os2.h directly so the
header is standalone.
2008-11-26 20:22:57 +00:00
Maarten Maathuis
77e60df32f cairo-xcb: avoid leaking memory 2008-11-21 18:31:04 +00:00
Chris Wilson
361962b7fb [directfb] Compile fix with debug enabled.
Fix a trivial compile failure reported here:
  Bug 18322 - bug in _cairo_directfb_surface_release_source_image function
  (http://bugs.freedesktop.org/show_bug.cgi?id=18322)
2008-11-21 18:29:54 +00:00
Carl Worth
d654d528de Blacklist "X.Org" < 7.0 with the buggy_repeat workaround.
This is in response to a report that a 6.9 server crashes with
cairo's extend-reflect test:

https://bugs.freedesktop.org/show_bug.cgi?id=15628#c2
2008-11-13 16:54:00 +01:00
Carl Worth
35a1ba0ddc Document the buggy_repeat workaround more carefully.
It's a confusing condition, so let's be explicit about where
the various numbers come from.
2008-11-13 16:54:00 +01:00
Behdad Esfahbod
a1ab11df01 Define RepeatNone, etc if the available Render version doesn't (#18385) 2008-11-05 11:54:54 -05:00
Adrian Johnson
6434cddb89 type1-subset: return unsupported on FT errors
and let type1-fallback handle it. This fixes the bug reported by
Peter Weilbacher in
http://lists.cairographics.org/archives/cairo/2008-October/015569.html
2008-11-02 21:21:59 +10:30
Chris Wilson
710f7d30d3 [scaled-font] Fix typo that prevented meta_surface lookup.
test/text-glyph-range was crashing since we requested the meta_surface but
the glyph wrongly believed it already had the meta_surface but was
checking for a path instead.
2008-10-31 02:24:05 +00:00
Chris Wilson
540f555840 [analysis] Only limit to mask extends if bounded by mask.
The extents of cairo_mask() is only limited to the mask if the operation
is bounded by the mask.
2008-10-30 16:19:54 +00:00
Chris Wilson
4b29988939 Review users of cairo_rectangle_int_t for incorrect unsigned promotion.
Adrian Johnson discovered cases where we mistakenly compared the result
of unsigned arithmetic where we need signed quantities. Look for similar
cases in the users of cairo_rectangle_int_t.
2008-10-30 16:19:38 +00:00
Chris Wilson
0e4156121f [rectangle] Fix unsigned promotion whilst computing intersect.
_cairo_rectangle_intersect() incorrectly allows unsigned promotion during
its arithmetic.
2008-10-30 16:19:26 +00:00
Chris Wilson
2464b8a0a9 [pattern] Allow the projected surface extents to be negative.
In order to handle projection of analysis surface with user-fonts we need
to accommodate patterns extending into negative coordinate space.
2008-10-30 16:19:11 +00:00
Chris Wilson
d5d29075bd [gstate] Allocate temporary variable for backend_to_user transform.
_cairo_gstate_backend_to_user_rectangle() requires that its input
arguments are non-NULL and describe the input rectangle to be transformed.
However, we were passing through output parameters from the public API
which were allowed to be NULL. So we need to allocate temporary variables
in which to compute the output rectangle, but only copy them as required.
2008-10-30 16:16:09 +00:00
Chris Wilson
42711a5586 [xlib] Fix _draw_image_surface() with opaque images.
If the image was opaque with no alpha channel, we filled the output alpha
with 0. Typically, the destination surface for dithering is an RGB window,
so this bug went unnoticed. However, test/xlib-expose-event is an example
where we generate an intermediate alpha-only pixmap for use as a stencil
and this was failing as the mask was left completely transparent. The
simple solution is to ensure that for opaque images, the output alpha is
set to the maximum permissible value.
2008-10-30 10:00:30 +00:00
Chris Wilson
c3940d342a [xlib] whitespace
Tweak the whitespace to lose some unnecessary line wrapping, casts and
blanks.
2008-10-30 10:00:30 +00:00
Carl Worth
a824d284be Remove the ability to select the internal font face with a name of "cairo".
It's not fair to steal this name from the namespace of family names.
There are definitely cairo.ttf files that exist out there, and people
may already be using these, (or may use them in the future), with
cairo_select_font_face and a family name of "cairo".

In place of this, we'll want to come up with some other new, and
documented API for selecting the internal font face.
2008-10-29 16:21:42 -07:00
Chris Wilson
1327ec232c [image] Remove invalid assert.
The assert can fail for an error surface.

TODO: Decide what values should be returned from getters for error
surfaces.
2008-10-28 10:00:38 +00:00
Chris Wilson
9481d999df [image] Check create_for_data() to ensure a valid minimum stride.
Double check that the user is not being silly by passing in a stride that
is too small for the width. evince/poppler is one such example...
2008-10-28 09:59:01 +00:00
Chris Wilson
22e2dac819 [stroke] Ensure we record the first face for a dashed path.
If the first face was outside the bounds then we skipped it, and so a
close would incorrectly connect to the first visible face.
2008-10-26 10:25:31 +00:00
Chris Wilson
64fb3290f0 [stroke] _cairo_stroker_line_to_dashed() whitespace
A couple of comment spelling mistakes and rearrange whitespace to more
closely match CODING_STYLE.
2008-10-26 10:25:26 +00:00
Chris Wilson
e6219f7116 [win32] Correct error paths in text_to_glyphs().
Carl spotted that 1db894 introduced an error into text_to_glyphs() such
that following an allocation error the code would attempt to thaw an
unfrozen glyph cache, leading to an attempt to unlock an unlocked mutex -
which causes a deadlock under win32.
2008-10-22 17:55:44 +01:00
Chris Wilson
954ebacb71 Map toy font face to implementation.
Quartz fonts and user fonts use an indirect font face when creating a
scaled font for the toy font face. This means that they insert a scaled
font into the font map that has a different font face to the one that is
initially searched upon. The result is that when we try to create an
identical scaled font, we fail to find the existing scaled font and
attempt to insert a duplicate into the hash table - which triggers an
assert.

In order to avoid creating duplicate fonts, we add a new method to the
font backends that allows cairo_scaled_font_create() to peek at the
font_face that will be used to actually implement the scaled font
constructor - thus we are able to use the correct font_face as part of the
hash key.
2008-10-22 16:38:12 +01:00
Adrian Johnson
5e4a1cb0b8 Don't add a notdef glyph to Type 3 font subsets
This allows user-fonts to use glyph 0 when embedding in PS/PDF.
According to ISO32000 Type 3 fonts do not require a notdef glyph.
2008-10-22 22:00:31 +10:30
Chris Wilson
170686d4b0 [cairoint] Remove the duplicate prototype.
In the previous commit I added comments and a duplicate prototype. Remove
the duplicate - but keep the comments.
2008-10-22 01:01:06 +01:00
Chris Wilson
1db8949f2b Ensure that the scaled font is frozen for the lifetime of the scaled glyph.
After discussing the scaled font locking with Behdad, it transpired that it
is not sufficient for a font to be locked for the lifetime of a scaled glyph,
but that the scaled font's glyph cache must be frozen for the glyph'
lifetime.  If the cache is not frozen, then there is a possibility that the
glyph may be evicted before the reference goes out of scope i.e. the glyph
becomes invalid whilst we are trying to use it.

Since the freezing of the cache is the stronger barrier, we remove the
locking/unlocking of the mutex from the backends and instead move the
mutex acquisition into the freeze/thaw routines. Then update the rule on
acquiring glyphs to enforce that the cache is frozen and review the usage
of freeze/thaw by all the backends to ensure that the cache is frozen for
the lifetime of the glyph.
2008-10-22 00:53:55 +01:00
Chris Wilson
29da47be60 [ps] Check for an empty font subset.
Return early before trying to emit an empty subset into the document -
avoids a potential use of an uninitialised status variable.
2008-10-21 10:42:41 +01:00
Chris Wilson
71e4f7e3a1 Add API documentation for NULL filenames and write_funcs.
Mention in the API docs that you can pass a NULL filename to
cairo_(pdf|ps|svg)_surface_create in order to construct a queryable
surface without generating any temporary files. Similarly when passing a
NULL write_func to cairo_pdf_surface_create_for_stream et al.
2008-10-20 23:54:57 +01:00