Commit graph

3389 commits

Author SHA1 Message Date
Behdad Esfahbod
38c5f0d49b [scaled-font-subsets] Fix UTF-8 mapping
Prevously all show_text_glyphs() clusters were using ActualText.  This
fixes that.

I have a feeling that the following scenario is broken still though:

  - show_text_glyphs maps glyph 1 to some utf8 text different from
    what index_to_ucs4 will give for glyph 1.  This will assign the
    utf8 text to glyph 1's ToUnicode.

  - show_glyphs shows glyph 1.  Since cluster has no utf8 text, we
    won't use ActualText and fall back to ToUnicode.  But the ToUnicode
    value assigned to glyph 1 is non-standard now.  We should use
    ActualText.

I have not verified this hypothesis though.
2008-08-08 03:01:18 -04:00
Behdad Esfahbod
bc4d363e92 [pdf-operators] Add note about clusters with no glyphs 2008-08-08 03:01:18 -04:00
Behdad Esfahbod
1bc404e346 Make utf8 handling in font subsets more consistent 2008-08-08 03:01:17 -04:00
Behdad Esfahbod
849159ddd1 [truetype] Fix gcc warning about possibly-infinite-loops 2008-08-08 03:01:17 -04:00
Behdad Esfahbod
178789c37a [cairo-scaled-font-subsets] Make utf8 handling more robust 2008-08-08 03:01:17 -04:00
Behdad Esfahbod
d9408041aa Add cairo_scaled_font_text_to_glyphs()
And update user-font text_to_glyphs() method to match.

Currently disable the win32-font text_to_glyphs(), until that one
is updated.  Or better yet, remove it and implement ucs4_to_index().
It's the toy font API afterall.
2008-08-08 03:01:16 -04:00
Behdad Esfahbod
b8fc845094 [cairo-scaled-font-subsets] Fix bug with utf8 handling 2008-08-08 03:01:16 -04:00
Behdad Esfahbod
6b3f6dc77a [unicode] Add _cairo_utf8_get_char_validated() 2008-08-08 03:01:16 -04:00
Behdad Esfahbod
8c514a40b8 Add cairo_glyph/text_cluster_allocate/free
These are needed by the upcoming cairo_scaled_font_text_to_glyphs()
2008-08-08 03:01:16 -04:00
Behdad Esfahbod
b01ad0835d [user-font] Add a cairo_t argument to cairo_user_scaled_font_init_func_t
The init func does not actually need to draw anything, but having a cairo_t
similar to that passed to render_glyph is handy for computing font extents.
This is because cairo makes doing some things really hard (if not impossible)
without a cairo_t.

The user-font-proxy test case is a great example of how the added cairo_t
makes life much easier.
2008-08-08 03:01:15 -04:00
Behdad Esfahbod
d6ae23478a Check for NULL pointer in cairo_set_scaled_font 2008-08-08 03:01:15 -04:00
Behdad Esfahbod
b67d34e960 [gstate] Check for NULL font_face in _cairo_gstate_set_font_face 2008-08-08 03:01:15 -04:00
Behdad Esfahbod
7e57892983 Add toy font constructor and getters
New public API:

	cairo_toy_font_face_create()
	cairo_toy_font_face_get_family()
	cairo_toy_font_face_get_slant()
	cairo_toy_font_face_get_weight()
2008-08-08 03:01:14 -04:00
Behdad Esfahbod
4bb7388b65 Remove unnecessary checks for CAIRO_STATUS_INVALID_STRING
We check that all input text is valid UTF-8.  Not sure why the code
was being lenient to invalid strings.
2008-08-08 03:01:14 -04:00
Chris Wilson
5bac12252c [xlib] Free regions on failure.
Fix leak of regions along error path.
2008-08-08 01:48:43 +01:00
Jeff Muizelaar
16939e1a86 Center the group pattern transform around the device_transformed origin
When popping a group, transform it by the ctm centered at the origin
specified by the device_transform so that it ends up in the right place
when we try to paint. This fixes the regressions caused by
1a9809baab as shown by the pdf backend.
2008-08-07 19:25:40 -04:00
Chris Wilson
f916e2178b [meta] Use the pre-computed device_transform_inverse.
Avoid repeatedly inverting the same matrix by using the pre-computed
inverse.
2008-08-07 23:54:25 +01:00
Chris Wilson
523f725801 [meta] Remove debugging assert.
Remove an old assertion that no error occurred.
2008-08-07 22:00:30 +01:00
Vladimir Vukicevic
34eb420cc7 [misc] Remove trailing comma on enum 2008-08-07 13:25:02 -07:00
Chris Wilson
7c1078b830 Check return from pixman_image_set_filter().
Adding warn_unused_result to pixman detected a couple of instances where
we abused the knowledge that the code currently can not fail, but in
deference to its independent existence we should be more cautious.
2008-08-07 14:01:54 +01:00
Chris Wilson
56619a16dd [cairo-surface] Use the pre-computed device_transform_inverse.
Avoid inverting the device_transform when copying the pattern for the
destination surface by using the pre-computed inverse.
2008-08-07 08:30:57 +01:00
Chris Wilson
6a4ddb6f47 [pattern] Set the reference count for stack allocations to 0.
Keep the reference count as zero for temporary, on-stack patterns in
order to detect attempts to keep references beyond their scope. (And
mismatched _init()/_destroy()).
2008-08-07 08:30:09 +01:00
Behdad Esfahbod
64ba6c74db Fix Ubuntu-specific issue with FC_LCD_NONE et al
No idea if Ubuntu will ever learn not to modify public API of
common libraries without any clue of what kind of problems they
create by doing that.  They could very well define
FC_UBUNTU_LCD_FILTER if they wanted to, but no, they defined
FC_LCD_FILTER as if it's an upstream thing.  It wasn't.
2008-08-06 18:37:03 -04:00
Chris Wilson
0ec6c9ca62 [pdf] Propagate status from emit_glyph()
Propagate the error status from _cairo_pdf_operators_emit_glyph().
2008-08-06 11:11:24 +01:00
Chris Wilson
2dfee9986c [pdf] Fixup a couple of inverted tests.
Check for NULL returns from malloc, instead of reporting errors and
leaking on success.
2008-08-06 10:51:34 +01:00
Chris Wilson
7ffd8bbcb0 [cairo-font-options] Add private alias for set_lcd_filter()
check-plt was rightfully claiming about an internal use of a public
symbol, so add the missing private alias.
2008-08-06 00:36:47 +01:00
Behdad Esfahbod
221599ab0f Finish off lcd-filter merge 2008-08-05 16:36:05 -04:00
Behdad Esfahbod
19b36fb887 [win32] Fix build 2008-08-05 16:36:04 -04:00
Sylvain Pasche
a0cad6c398 [cairo-ft] Interaction with Fontconfig to deal with the LCD filter type 2008-08-05 16:30:36 -04:00
Sylvain Pasche
f64cf7fb09 [cairo-xlib] Support to retrieve the LCD filter type from the Xrm database 2008-08-05 16:30:36 -04:00
Sylvain Pasche
28d18f3f93 [cairo-ft] Fontconfig defines for LCD constants when using Fontconfig < 2.6
This adds define for compatibility when without the new lcd filtering
constants (Fontconfig patch not yet applied, see bug 13566).
2008-08-05 16:30:36 -04:00
Sylvain Pasche
0013f2c269 Add lcd filter type to the public API and font options
New struct cairo_lcd_filter_t and new functions
cairo_font_options_set_lcd_filter
cairo_font_options_get_lcd_filter
2008-08-05 16:30:36 -04:00
Sylvain Pasche
4b5e0ba720 [cairo-ft] LCD filtering patch coding style corrections 2008-08-05 16:30:35 -04:00
Sylvain Pasche
7f87003517 [cairo-ft] LCD filtering patch from David Turner
This is the patch David Turner wrote some times ago and can be found on
http://david.freetype.org/lcd/cairo-1.2.4-lcd-filter-1.patch. It was
somewhat modified for compatibility with cairo 1.5
2008-08-05 16:30:35 -04:00
Vladimir Vukicevic
acdc306905 [win32] Adding cairo-features-win32.h to EXTRA_DIST 2008-08-05 13:16:17 -07:00
Vladimir Vukicevic
924a242f89 [win32] Update win32 build, remove gcc dependency 2008-08-05 12:57:51 -07:00
Jeff Muizelaar
e1132d434e Make cairo_scaled_font_glyph_extents() unconditionally zero the extents
This makes cairo_scaled_font_glyph_extents() match a similar pattern of
initialization in cairo_glyph_extents(). It also fixes the 'text-zero-len' test
that was broken by 676b221326.
2008-07-30 13:05:01 -07:00
Peter Weilbacher
d560a3d965 [OS/2] Fix build 2008-07-25 11:19:11 -04:00
Behdad Esfahbod
ba95b9dee8 [cairo-ft] Use FcFreeTypeCharIndex instead of FT_Get_Char_Index 2008-07-25 11:18:22 -04:00
Jeff Muizelaar
1a9809baab Fix scaling with a device offset
Apply the device offset transformation to the pattern before the ctm one.
Fixes bug #16469.
2008-07-21 22:24:42 -04:00
Vladimir Vukicevic
96c9e2a1a8 Fix cairo-quartz-image-surface compilation error 2008-07-18 15:55:11 -07:00
Carl Worth
ec9337697e cairo.h: Remove trailing comma in enumeration 2008-07-17 19:31:11 -07:00
Vladimir Vukicevic
d61c7df1c0 [quartz] Take snapshot instead of using CGImageCreateCopy
CGImageCreateCopy doesn't copy the data provider, so it's possible to
free the data underneath an image without snapshotting it first.
2008-07-09 13:20:53 -07:00
Vladimir Vukicevic
e534b0bed1 [quartz] Protect against NULL from CGFontGetHMetricsPtr
Seems to happen on 10.4 only for unknown reasons.  Protect against a crash at least.
2008-07-09 13:06:23 -07:00
Adrian Johnson
7127089fe6 PDF/PS: Remember the current line style
So we don't need to emit line style parameters that are already set.
2008-07-08 22:57:22 +09:30
Adrian Johnson
837bf73f08 Add PDF operators function to reset any remembered state 2008-07-08 22:00:15 +09:30
Adrian Johnson
9b302fac63 PDF: Oops - turn compression back on 2008-07-08 21:51:41 +09:30
Adrian Johnson
50eb1e71f3 PS: Ensure the color is re-emitted after resetting the clip path
because the graphics state has been restored.
2008-07-08 21:36:19 +09:30
Adrian Johnson
b082c15df6 PDF: Don't use a Form dictionary for the content stream
because pdfTeX (and maybe other PDF consumers) can not handle it.

Previously the content stream was an Form dictionary because at the
time the content is written it is not known whether the content stream
will be belong to the page or be an XObject in a knockout group. With
the additional of the paginated surface function
set_fallback_images_required() this information is now known at the
time the content is emitted.
2008-07-08 21:18:45 +09:30
Adrian Johnson
4fcdc364cd Add paginated surface backend function _set_fallback_images_required 2008-07-08 21:12:54 +09:30