Commit graph

3087 commits

Author SHA1 Message Date
Jeff Smith
89010db3ad Add or reword several comments in the stroking code 2007-02-19 16:06:57 -05:00
Jeff Smith
adb573d0ba Minor changes to shorten the stroking code 2007-02-19 16:06:57 -05:00
Jeff Muizelaar
fb29fddd40 Rename tmp to step_length because that is what it actually is. 2007-02-19 16:06:57 -05:00
Jeff Muizelaar
afd5f92195 Fix several issues with dashed stroking code, particularly 'leaky-dash'
Adds some state, 'dash_starts_on', to keep track of whether a dashed path
starts with dash_on or not. This fixes the 'leaky-dash' bug (#4863) and
some other degenerate cases. The new version is, in my opinion,
considerably cleaner and more understandable than the old code.

Finally, the rewrite changes the behaviour of dashing to add degenerate
caps around corners that start at the same place as a dash begins. This
matches the behaviour seen in acroread.

This rewrite is based on an initial rewrite done by Jeff Smith.
2007-02-19 16:06:57 -05:00
Jeff Muizelaar
78ae474d96 Rename has_sub_path to has_initial_sub_path
has_initial_sub_path more accurately describes the condition we want to
track. This flag is used to indicate when an initial sub_path needs capping
but has no associated slope and thus no associated faces.
2007-02-19 16:06:56 -05:00
Jeff Muizelaar
9f3fb4f753 Add a comment about the point choice when capping degenerate paths 2007-02-19 16:06:56 -05:00
Jeff Smith
a1a4d6966e Modify how _cairo_stroker_add_caps handles zero-length sub-paths
For zero-length sub-paths, _cairo_stroker_add_caps sets up a dummy face,
then lets later parts of the function add the caps.
2007-02-19 16:06:56 -05:00
Jeff Smith
849a9ef81b Change type of cairo_stroker_t's dash_on from int to cairo_bool_t 2007-02-19 16:06:56 -05:00
Jeff Muizelaar
74ded42327 Add a new dashing test
This new dashing test, based on some code from Jeff Smith, does a pretty
good job exploring all the cases that the dashing code needs to deal with.
2007-02-19 16:06:56 -05:00
Jeff Muizelaar
1c1697398c Add two new test cases to degenerate-path test
These new cases deal with degenerate paths at the end of dashed paths. They
currently fail.
2007-02-19 16:06:56 -05:00
Adrian Johnson
9927dde533 TrueType: fix bug #9998 - build error with gcc 2.95 2007-02-17 10:55:14 +10:30
Brian Ewins
9bae496a0a [ATSUI] implement load_truetype_table
Implements load truetype table, allowing selection of
text and searching in pdfs generated using the atsui
font backend.
2007-02-15 23:08:40 +00:00
Adrian Johnson
16e20568a5 TrueType: Add post table and 3,0 cmap encoding
Commit 05ff2c77da contained
a fix for the acroread printing problem. However this
patch caused a problem for the Mac Preview PDF viewer.

  http://lists.freedesktop.org/archives/cairo/2007-February/009615.html

This patch fixes the Mac Preview problem. The patch

- Adds a platform 3, encoding 0 cmap table
- Adds a post table that maps the glyph names in the
  PDF truetype font dictionary (/g0 /g1 /g2 ...)
  to glyph indices in the font.
2007-02-16 08:38:26 +10:30
Jorn Baayen
2715f20981 [cairo-pattern] Cache surface for solid patterns
We use a small cache of size 16 for surfaces created for solid patterns.
This mainly helps with the X backends where we don't have to create a
pattern for every operation, so we save a lot on X traffic.  Xft uses a
similar cache, so cairo's text rendering traffic with the xlib backend
now completely matches that of Xft.

The cache uses an static index variable, which itself acts like a cache of
size 1, remembering the most recently used solid pattern.  So repeated
lookups for the same pattern hit immediately.  If that fails, the cache is
searched linearly, and if that fails too, a new surface is created and a
random member of the cache is evicted.

Only surfaces that are "compatible" are used.  The definition of compatible
is backend specific.  For the xlib backend, it means that the two surfaces
are allocated on the same display.  Implementations for compatibility are
provided for all backends that it makes sense.
2007-02-14 18:28:56 -08:00
Carl Worth
b31179478b Bump cairo version to 1.3.15 after making the 1.3.14 snapshot 2007-02-14 00:48:42 -08:00
Carl Worth
90e453fc22 Increment cairo version to 1.3.14 (and libtool versioning to 12:4:10) 2007-02-14 00:34:18 -08:00
Carl Worth
513f21140b NEWS: Add notes for the 1.3.14 snapshot 2007-02-14 00:32:54 -08:00
Carl Worth
51ca187d3e Mark test/rotate-image-surface-paint as XFAIL
This test has always failed with the ps backend since the test
was initially written.
2007-02-13 23:55:03 -08:00
Carl Worth
9966551dc7 Fix cairo_ft_unscaled_font_t to have a lock_count again not an is_locked Boolean
This was inadvertently changed as part of fdffde8b9e

With the Boolean, pango-using programs that locked the same
unscaled_font multiple times would crash with a message such as:

 cairo-ft-font.c:569: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->is_locked' failed.
2007-02-13 23:49:26 -08:00
Carl Worth
7adab2866b Add missing call to set_scale of unscaled_font in scaled_glyph init
This fixes a regression introduced with commit:

	25a370d799

This was showing up as a failure of the bitmap-font test case
with the ps, pdf, and svg backends.
2007-02-13 22:05:57 -08:00
Jinghua Luo
17b4496ae9 type1-subset: fix error handling.
This fixes potenial memory leak and leaving font face locked on error.
2007-02-14 11:52:11 +08:00
Dan Amelang
01a133167c Update Win32 makefiles
Since the last time these makefiles were last updated some new source
files have been added and one renamed. In addition, a "clean" rule
needed to be added to the pixman makefile. And the "clean" rule in the
main cairo makefile wasn't working properly for me.
2007-02-13 16:53:12 -08:00
Carl Worth
b8987dd12c ROADMAP: Note that text spacing issues for win32 are fixed 2007-02-13 16:47:30 -08:00
Dan Amelang
f0a16b5bdd Fix Win32 text spacing problem
Thanks to Jordan Miner for reporting the problem and a fix.
2007-02-13 16:32:05 -08:00
Carl Worth
aad1374caa Rename cairo_toy_font_face_hash_table_mutex to cairo_font_face_mutex
The new name more accurately reflects its recently expanded role.
2007-02-13 10:59:51 -08:00
Carl Worth
e107b70b4d Add locking to cairo_font_face_reference/destroy
The reference count of cairo_font_face_t is rather intimately tied,
(for toy font faces), with the cairo_font_face_hash_table, so we
expand the existing cairo_toy_font_face_hash_table_mutex to cover
the manipulation of font_face->ref_count as well.

This commit eliminates an assertion failure that is (occasionally)
exposed by the pthread-show-text test case:

lt-pthread-show-text: cairo-hash.c:196: _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.
2007-02-13 10:58:20 -08:00
Carl Worth
d6d1767f9a Increase pthread-show-text thread count and add cairo_select_font_face to expose more bugs. 2007-02-13 10:47:06 -08:00
Carl Worth
fdffde8b9e Add mutex to implement _cairo_ft_unscaled_font_lock_face and _cairo_ft_unscaled_font_unlock_face
Previously we just had an integer counter here, but that is not
sufficient as multiple cairo_scaled_font_t objects, (which are
implicitly shared through the font caches), can reference the
same cairo_ft_unscaled_font_t so real locking is needed here.

This commit eliminates an assertion failure exposed by the
pthread-show-text test case:

lt-pthread-show-text: cairo-ft-font.c:562: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->lock > 0' failed.
2007-02-13 10:46:52 -08:00
Carl Worth
25a370d799 Avoid public cairo_ft_scaled_font_lock_face for internal use
We're planning to change the implementation of the public function,
(which will remove some locking safety), so use the safe, locked
_cairo_ft_unscaled_font_lock_face for internal use instead.
2007-02-13 10:40:53 -08:00
Carl Worth
7e1301ffb0 Add missing _cairo_ft_unscaled_font_unlock_face to _cairo_ft_scaled_font_create 2007-02-13 10:22:32 -08:00
Adrian Johnson
6f7cfdf5c7 PDF: Add missing character code to Differences array 2007-02-13 23:53:38 +10:30
Adrian Johnson
88cae7766d output-stream: coding style fix 2007-02-13 23:29:05 +10:30
Adrian Johnson
88f7ea4ad7 CFF: Fix Visual C++ compile problem
Don't use structure intitialization for assigning
structure values.

Add a new field to cff_charset_t to point to the sids
charset array instead of casting it into the data field.
2007-02-13 22:52:53 +10:30
Adrian Johnson
ac01dcb5ad PDF: Remove dead code
The function _cairo_pdf_surface_write_fonts is the
original PDF TrueType font embedding function that was
disabled in commit f500cef19f
shortly before Type3 font support was added.

TrueType font embedding was later reintroduced as new code
making this function obsolete.
2007-02-11 23:14:40 +10:30
Adrian Johnson
d6f15b2600 Output-stream: Omit the minus sign from negative zero 2007-02-11 22:20:58 +10:30
Adrian Johnson
a2fefcc9e9 PDF: Compress Type3 fonts 2007-02-11 21:57:43 +10:30
Adrian Johnson
9f47879ae3 PDF: Fix Type3 font metrics to make text selection work 2007-02-11 21:50:46 +10:30
Brian Ewins
9dce321a11 [ATSUI] scale fonts using font size not font matrix
Mozilla bug #327522 - fonts scaled up over 16pt on mac
had nonsensical extents. The scaling was being done using
the font matrix, it turns out this does not work for 16x
scaling and up. This patch switches back to using the
font size to scale fonts, with emboldening and condensing
effects applied separately using the font matrix.
2007-02-11 01:42:22 +00:00
Brian Ewins
eec62c2975 Unreleased lock typo in cairo-scaled-font.c
One path through _cairo_scaled_font_text_to_glyphs grabbed
the mutex but didn't release it, causing hangs in all
text rendering on the mac.
2007-02-10 00:20:40 +00:00
Eugeniy Meshcheryakov
a37f21cb17 [PS/PDF/SVG] Return a write_error nil surface on write errors 2007-02-08 15:29:58 -08:00
Eugeniy Meshcheryakov
bf3cbe7660 [cairo-surface] Use a macro definition for all nil surfaces 2007-02-08 15:28:14 -08:00
Kalle Vahlman
aea0831d24 [cairoint] Make it compile with libpng disabled 2007-02-08 15:07:45 -08:00
Peter Weilbacher
4773b8a6d2 Oops, correct typo in previous commit
FALSA -> FALSE
2007-02-08 20:34:26 +01:00
Peter Weilbacher
e711700d5d Correct scaled font mutex definitions for OS/2
Using a zero without brackets to quiet remaining GCC compilation warning.
Use FALSE so that the mutex does not block on creation.
2007-02-08 20:29:18 +01:00
Adrian Johnson
2d1db24d1e PDF: Another fix for TrueType metrics
Not all TrueType fonts have an em size of 2048.
2007-02-07 23:10:47 +10:30
Adrian Johnson
274dfa4598 PDF: Make text selection and extraction work
- Add a to_unicode array to the scaled_font_subsets
  for mapping glyphs to unicode characters

- Add a function to the TrueType subsetting for
  performing a reverse cmap for mapping glyph indices
  to unicode characters.

- Add a new scaled font backend function for mapping
  glyph indices to unicode characters. Provide FreeType
  and Win32 implementations of the font backend mapping
  function.

- Modify the PDF backend to embed ToUnicode streams
  into each font. The unicode mapping is obtained by
  first trying the reverse cmap. If this fails the font
  backend mapping function is called.
2007-02-07 22:35:59 +10:30
Carl Worth
97a2522e0b Add missing locking to _cairo_scaled_font_text_to_glyphs
We recently added locking to cairo_scaled_font_glyph_extents and
to _cairo_surface_show_glyphs, but we had neglected the third
separate entry point into scaled_font code that does cache-using
glyph lookups, namely: _cairo_scaled_font_text_to_glyphs.

These three separate functions are plainly visible in the
implementation of cairo_show_text.
2007-02-06 21:19:30 -08:00
Carl Worth
1503a41c7f Expand font_map locking to cover call to backend->scaled_font_create
It seemed like a good idea to avoid holding the lock over the call
into the backend. But the procedure in place was quite broken:

	LOCK
	Fail to find font in hash table
	UNLOCK
	Create font
	LOCK
	Insert font into hash table
	UNLOCK

since while we're busy creating the font and unlocked, another thread
can insert the font. Our paranoid hash table implementation noted
the problem quite readily.

This patch simply removes the internal UNLOCK/LOCK to hold the mutex
over the whole procedure.
2007-02-06 20:42:09 -08:00
Carl Worth
fc3ce1e80a test/pthread-show-text: Increease iterations to expose locking bug
With 50 iterations I'm seeing the following assertion failure:

cairo-hash.c:477: _cairo_hash_table_insert: Assertion `NOT_REACHED' failed.

Thanks to Jan Slupski <jslupski@juljas.net> for pointing out this bug.
2007-02-06 20:41:58 -08:00
Carl Worth
d07827ba2a ROADMAP: Drop 1.3.6 which is already in the past and note 8379 fix and pixman gradient improvements 2007-02-06 19:06:23 -08:00