Commit graph

3150 commits

Author SHA1 Message Date
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
Carl Worth
672a668da1 ROADMAP: Note that the 8801 locking bug is fixed. 2007-02-06 19:05:07 -08:00
Carl Worth
db3493bef7 Remove dead cff_dict_remove function
I assume this was just a leftover that was meant to be removed
earlier. If not, please feel free to bring it back again.
2007-02-06 18:28:44 -08:00
Carl Worth
89cf8dbf52 Remove half-leftover debugging code from previous commit
This was leading to link failures on CAIRO_LOCK_FILE, etc.
2007-02-06 18:27:33 -08:00
Carl Worth
5d58e7ee66 Add scaled_font->mutex to allow locking for all subordinate objects
A cairo_scaled_font_t can be implicitly shared among multiple threads
as the same cairo_scaled_font_t can be returned from different calls
to cairo_scaled_font_create. To retain the illusion that these
different calls produce distinct objects, cairo must internally lock
access when modifying them.

Each glyph in the scaled font is represented by a cairo_surface_t
which is used when rendering the glyph. Instead of attempting to push
fine-grained locking of these surfaces down to the backend rendering
functions, a simple per-cairo_scaled_font_t lock has been introduced
which protects the entire rendering path against re-entrancy.

Some care was required to ensure that existing re-entrancy was handled
appropriately; these cases are in the wrapping surfaces
(cairo-paginated, test-meta and test-paginated).

Thanks to Vladimir Vukicev and Peter Weilbacher for testing/providing
the mutex definitions for win32 and os2 (respectively).
2007-02-06 17:53:27 -08:00
Carl Worth
765715ad93 Move scaled font holdovers magic from reference to create to fix race condition
Previously, with the magic in _cairo_scaled_font_reference(),
cairo_scaled_font_create() was releasing its lock just before
calling into reference() which would re-acquire the lock.
That left a window open during which a font we just discovered
in the holdovers table could be destroyed before we had a chance
to give it its initial reference back.
2007-02-06 17:53:27 -08:00
Carl Worth
9c359d61fc Avoid holding lock when calling _cairo_scaled_font_fini
As in the previous commit with the backend->scaled_font_create
function, we also don't want to hold the lock when calling into
the backend's fini function.
2007-02-06 17:53:27 -08:00
Carl Worth
258175ffcd Don't hold mutex over backend->scaled_font_create
This also allows some cleanup of the error-handling in
cairo_scaled_font_create, (no more goto statements).
2007-02-06 17:53:26 -08:00
Adrian Johnson
fc660511ec PDF: Correct the y value of Td in show_glyphs
This bug would occur if the y coordinate of all the glyphs
in a single cairo_show_glyphs() call was not the same.
2007-02-07 11:05:33 +10:30
Soren Sandmann Pedersen
908469b5fc Apply patch from Marco Gritti and Jordan Crouse to correctly detect
AMD CPU's. Bug 9615.
2007-02-06 16:37:45 -05:00
Soren Sandmann Pedersen
9d3f537423 Remove left-over assert and some alpha checks from
fbCompositeSrc_8888x0565mmx(). Bug 9893.
2007-02-06 16:27:42 -05:00
Adrian Johnson
a8f8efb750 PS: Correct the TrueType Encoding and Charstrings
The offsets and count was out by one as a result of the
change to include .notdef on the TrueType font.
2007-02-05 18:29:30 +10:30
Adrian Johnson
28e3a20d79 PDF: Fix TrueType font metrics 2007-02-04 23:47:28 +10:30
Adrian Johnson
05ff2c77da PDF: Add Encoding dictionary to TrueType fonts
This is a fix for the bugs reported here

  http://lists.freedesktop.org/archives/cairo/2006-December/008984.html

  http://lists.freedesktop.org/archives/cairo/2007-January/009387.html

Cairo PDFs will not print correctly from Adobe Reader. The symptoms are
that all the glyphs on the page are replaced with the same glyph.

According to the PDF Reference an Encoding dictionary is not required
for the symbolic fonts used by cairo. However including the Encoding
dictionary fixes the printing problem.
2007-02-04 19:00:16 +10:30
Adrian Johnson
3f8d5f505a TrueType: Include notdef glyph in the subset
Required by the TrueType specification.
2007-02-04 18:21:50 +10:30
Adrian Johnson
d22ba141e6 TrueType Subsetting: Whitespace change 2007-02-04 16:58:04 +10:30
Adrian Johnson
e4a5011a27 TrueType Subsetting: Add comment 2007-02-04 16:51:44 +10:30
Eugeniy Meshcheryakov
7d05b9bdd3 TrueType Subsetting: Sort table directory
The TrueType specification requires the table directory
to be sorted by tag.
2007-02-04 16:36:01 +10:30
Eugeniy Meshcheryakov
8b31761583 TrueType Subsetting: Correct the checksum calculation of 'head' table
Checksum field should be zero before calculating checksum.
2007-02-04 16:22:12 +10:30
Eugeniy Meshcheryakov
0bf5e18b14 TrueType Subsetting : Correct the checksum calculation 2007-02-04 16:19:05 +10:30
Carl Worth
2bd590b649 ROADMAP: Note that linear gradient bug is fixed. 2007-02-02 16:43:27 -08:00
David Turner
ae4f37e0a3 fixing gradient repeat mode computations
This fixes the regression of linear gradient as demonstrated
by the recently added linear-gradient-reflect test.
2007-02-02 16:42:43 -08:00
T Rowley
0b7ba5ccfa Add linear-gradient-reflect test case
This testcase works before the
e9bef30d2b landing, and has visual
artifacts afterwards.
2007-02-02 16:37:27 -08:00
Carl Worth
1757b49ebd ROADMAP: Add bug about broken cairo_show_text on win32 2007-02-01 16:17:29 -08:00
Carl Worth
c621201a41 Don't finish a finished surface in cairo_surface_destroy
Calling cairo_surface_finish from cairo_surface_destroy was
triggering an error due to finish being called twice. The
error was usually hidden as the surface would still eventually
be destroyed. But it did clutter things up quite badly if a
user was trying to break on _cairo_error to track down a
problem.

Thanks again to Stuart Parmenter <stuartp@gmail.com>
for pointing out the problem.
2007-02-01 16:05:59 -08:00
Carl Worth
159359325d Fix crashes in cairo_surface_finish for NULL or nil
Thanks to Stuart Parmenter for alerting us of this bug.
2007-02-01 15:22:27 -08:00
Carl Worth
26ef4746e6 Add two tests of cairo_surface_finish to test/nil-surface.c
This tests calling cairo_surface_finish with either NULL or
with a nil surface, (either currently causes a crash).
2007-02-01 15:21:12 -08:00
Dan Amelang
382e021ccb Add "rectangles" perf test
This test draws many small, solid pixel-aligned rectangles one at a
time.
2007-01-31 11:53:06 -08:00
Eugeniy Meshcheryakov
7abfb39709 CFF Subsetting: Add charset data to embedded font
Current code for subsetting CFF fonts does not write charset information
into it. According to spec this means that font have ISOAdobe charset.
This charset contains only 228 names (excluding .notdef). This is not
enough for subfonts with 256 glyphs and causes bugs when viewing
generated PDFs.
2007-01-28 19:01:38 +10:30
Carl Worth
a63ceef06c Fix _cairo_pattern_acquire_surface_for_surface to not clone outside surface extents
Rotation and other transformations would cause extents to be
computed which were outside the bounds of the surface to be
cloned, (and for non repeating patterns). Now we simply
restrict the computed extents to the surface extents.

This fixes the xlib failure of the recent rotate-image-surface-paint
test, (the apparently distinct ps failure remains).
2007-01-26 18:03:43 -08:00
Carl Worth
ebc1cd91f8 Add rotate-image-surface-paint test case
This test exercises a clone_similar extents bug noticed by
Benjamin Otte. As expected, the xlib backend fails due to
that bug, (and interestingly, the ps backend is showing a
failure as well).
2007-01-26 11:43:27 -08:00
Vladimir Vukicevic
691f9d1c0c [mmx] avoid casts between int32 and __m64 types
The MS compiler doesn't like this; _mm_cvtsi32_si64 and _mm_cvtsi64_si32
must be used.
2007-01-25 12:01:50 -08:00
Vladimir Vukicevic
8ff70d6b91 [win32] regression with win32 glyph y-offsets (mozbug#365021) 2007-01-25 12:01:50 -08:00
Vladimir Vukicevic
0231d18a57 [atsui] add function prototype for a public 10.4 function that's 2007-01-25 12:01:50 -08:00
Eugeniy Meshcheryakov
50136a7806 [PDF-CFF] Fix bad /LastChar value for CFF fonts in PDF backend
PDF backend sets /LastChar value in Type1C font dictionary incorrectly.
acroread then complains about incorrect /Widths in font.
The last char is numchars - 1, since it's zero-based.
2007-01-24 15:51:00 -05:00
Michael Emmel
bb02b4e5ec Merge branch 'master' of ssh+git://git.cairographics.org/git/cairo 2007-01-23 22:22:20 -08:00
Michael Emmel
48c2896f69 Turned off acclerated rectangle drawing in dfb backend
causes bugs in gtk
2007-01-23 22:17:24 -08:00
Behdad Esfahbod
3b7751279c [pixman/src/fbmmx.c] Add comment around M64
/* cast to void* in the middle to shut gcc up warning about
 * "dereferencing type-punned pointers".
 */
2007-01-22 14:42:48 -05:00