Commit graph

5385 commits

Author SHA1 Message Date
Adrian Johnson
37ed55acef Add missing status checks 2008-07-03 20:27:50 +09:30
Behdad Esfahbod
85de817e09 [analysis-surface] Fallback between show_glyphs and show_text_glyphs
This is needed because analysis-surface takes any UNSUPPORTED returns
as a signal for using image fallbacks.  So the fallback mechanism in
_cairo_surface_show_text_glyphs() is not enough.  Reported by Adrian
Johnson.
2008-07-02 19:21:50 -04:00
Behdad Esfahbod
d19d9b4149 [cairo-pdf-operators] Fix backward cluster iteration
It's trickier than it appears...

There still remains the question of whether the loop should iterate
utf8 forward and glyphs backward (as it does now), or iterate glyphs
forward and utf8 backward.

Doing utf8 forward has the benefit that glyphs appear in the PDF stream
in the logical order of text.  That may be a good thing.

Doing glyphs forward has the benefit of most glyphs taking their natural
width, providing for a more compact PDF output.

Firefox 3 currently calls cairo_show_glyphs() with glyphs going
right-to-left for RTL runs.  That's like going utf8 forward.

On the other hand, if we are fine doing glyphs backward, then we may as
well remove the "backward" flag and ask callers of show_text_glyphs to
produce glyph array going right to left for RTL runs.  The idea behind
having a backward flag in the first place was to allow keeping utf8 in
logical order and glyphs in visual left-to-right order.  If we don't
do that in practice, there's no point in having the flag.  Another design
idea of the flag was to mark right-to-left runs explicitly so the backend
can use this information.  In that case we probably better rename it to
"rtl" as the current semantics make it perfectly fine to set a LTR segment
with backward flag on: just revers the glyph array...

Anyway, the way to determine the right thing to do is to see how Acrobat
extracts text for RTL text in logical vs visual order.  Then we can decide
what to do in the PDF backend and whether the flag is worth keeping.
Going to experiment with that.
2008-07-01 01:04:10 -04:00
Behdad Esfahbod
c29029ce43 Remove _cairo_surface_show_glyphs() in favor of _cairo_surface_show_text_glyphs() 2008-06-30 22:11:48 -04:00
Behdad Esfahbod
17a5f10f53 [show_text_glyphs] Allow clusters with zero text
As Adrian points out, PDF can handle it, and it doesn't harm allowing.
2008-06-29 15:00:10 -04:00
Behdad Esfahbod
686fa2600d [PDF] Remove show_glyphs that was a wrapper to show_text_glyphs
The cairo-surface layer already does that itself.  Just set show_glyphs
to NULL.
2008-06-29 13:56:14 -04:00
Chris Wilson
6227d80844 [cairo-scaled-font-subsets] And free the allocated memory on failure.
Why, oh why, did I only spot this when reading cairo-commit?
2008-06-29 14:33:31 +01:00
Chris Wilson
c394b72ee9 [cairo-scaled-font] Suppress compiler warning about unused variables.
Use _cairo_error_throw() for the cases where we cannot propagate the
status return.
2008-06-29 13:16:10 +01:00
Chris Wilson
5b7903d5a7 [cairo-scaled-font-subsets] Add missing malloc check.
A minor oversight in d77b04fd06.
2008-06-29 13:09:17 +01:00
Adrian Johnson
22facbe66e Add show_text_glyphs to PDF surface 2008-06-29 19:55:41 +09:30
Adrian Johnson
770b7c9a74 Add show_text_glyphs to PDF operators 2008-06-29 19:55:02 +09:30
Adrian Johnson
55dda8c64f Remove unused map_glyphs_to_unicode functions 2008-06-29 19:36:29 +09:30
Adrian Johnson
2012d4f736 Removed unused cairo_truetype_create_glyph_to_unicode_map() 2008-06-29 19:36:10 +09:30
Adrian Johnson
154324f121 Use subset utf8 mapping to create the glyph names for PS fonts 2008-06-29 19:35:43 +09:30
Adrian Johnson
2a21fafa07 Use subset utf8 mapping in PDF ToUnicode stream 2008-06-29 19:35:12 +09:30
Adrian Johnson
d77b04fd06 Allow _cairo_scaled_font_subsets_map_glyph() to specify utf8 mapping 2008-06-29 19:33:58 +09:30
Adrian Johnson
f4d6e714a6 Add _cairo_ucs4_to_utf8 2008-06-29 19:32:19 +09:30
Adrian Johnson
2f99a294cd Add _cairo_truetype_index_to_ucs4()
for doing reverse cmap lookups on truetype/opentype fonts one glyph at
a time.
2008-06-29 19:31:47 +09:30
Adrian Johnson
95771d62c5 Implement win32 index_to_ucs4 font backend function 2008-06-29 19:31:23 +09:30
Adrian Johnson
4619b0b309 Add index_to_ucs4 font backend function and FT implementation 2008-06-29 19:30:14 +09:30
Adrian Johnson
54f63e7859 PDF: Ensure text object is closed before emitting fill or stroke 2008-06-29 19:28:39 +09:30
Behdad Esfahbod
4ffea75d90 Change cairo_text_cluster_t members signed
Also reject clusters with no text.
2008-06-27 11:18:22 -04:00
Behdad Esfahbod
4530c0b0ec [meta-surface] Implement show_text_glyphs; Remove show_glyphs
One is enough.  The only downside is that meta-surface will consume
32 more bytes per show_glyphs() call now.  If that's a concern,
the show_glyphs implementation can be added back.
2008-06-26 17:15:42 -04:00
Behdad Esfahbod
93c3eebc6e [paginated-surface] Implement show_text_glyphs 2008-06-26 16:45:09 -04:00
Behdad Esfahbod
8f02cadf3d [analysis-surface] Implement show_text_glyphs 2008-06-26 16:44:59 -04:00
Behdad Esfahbod
047566fd52 Add cairo_show_text_glyphs API
New public API:

	cairo_text_cluster_t
	cairo_has_show_text_glyphs()
	cairo_show_text_glyphs()

Add accompanying gstate and surface functions, and surface backend methods.
No backends implement them just yet.
2008-06-26 16:20:59 -04:00
Behdad Esfahbod
dff0dd0c63 Allow NULL output in _cairo_utf8_to_ucs4()
The function can be used to validate UTF-8 text now.
2008-06-26 16:20:59 -04:00
Behdad Esfahbod
883c972a9b [cairo-types] fix doc syntax 2008-06-26 16:20:59 -04:00
Behdad Esfahbod
787fb13566 [xlib] Use _cairo_xlib_surface_create_internal() directly 2008-06-26 16:20:58 -04:00
Behdad Esfahbod
ba62d2d30a Update .gitignore files 2008-06-26 16:20:58 -04:00
Behdad Esfahbod
425846dedb Oops. Fix thinko in previous commit. 2008-06-24 15:09:33 -04:00
Behdad Esfahbod
74789a702b Cleanup _set_error functions a bit 2008-06-24 15:07:07 -04:00
Behdad Esfahbod
ace3a98a53 Make sure cairo_int_status_t values fit in int8_t
It was reported by Liu Yubao that cairo_status_t may be chosen to be
an int8_t by the compiler, in that case cairo_int_status_t values
assigned to cairo_status_t would overflow.  Fix this by allocating
the values in int8_t range, and add compile-time sanity checks.
2008-06-24 15:02:14 -04:00
Behdad Esfahbod
f32090fb34 Return CAIRO_STATUS_NEGATIVE_COUNT if num_glyphs is negative 2008-06-23 17:56:28 -04:00
Behdad Esfahbod
498f3ddf2e Add status CAIRO_STATUS_NEGATIVE_COUNT
To be used for things like passing a negative number of glyphs
to cairo_show_glyphs().
2008-06-23 17:53:25 -04:00
Behdad Esfahbod
ce24588d1c [doc] Update doc/public/Headers.mk 2008-06-23 17:51:32 -04:00
Behdad Esfahbod
676b221326 Protect against NULL glyphs array in text API
We still don't do anything if num_glyphs is negative.  Why isn't
that argument unsigned int...
2008-06-23 17:42:29 -04:00
Behdad Esfahbod
233b387c29 Use #include "cairo-*." instead of #include <cairo-*.h>
The rule is simple: <x.h> for system / other project includes,
"x.h" for local includes.
2008-06-23 00:30:04 -04:00
Behdad Esfahbod
9fea50a1e6 Rename _cairo_font_reset_static_data to _cairo_font_face_reset_static_data 2008-06-22 15:15:44 -04:00
Behdad Esfahbod
7407362d70 Rename cairo_quartz_scaled_font_backend to _cairo_quartz_scaled_font_backend 2008-06-22 15:13:42 -04:00
Behdad Esfahbod
4240794ea4 Rename cairo_win32_scaled_font_backend to _cairo_win32_scaled_font_backend 2008-06-22 15:13:15 -04:00
Behdad Esfahbod
e09f20fe01 [gstate] Fix huge-font path;fill fallback options 2008-06-22 14:50:08 -04:00
Behdad Esfahbod
d9784c8c37 [cairo-xlib] Don't undither pseudocolor, doesn't look good 2008-06-19 22:24:13 -04:00
Behdad Esfahbod
fe41d100aa [cairo-xlib-surface] Fix core solid_fill_rectangles to do dithering
Do this by tiling the surface form the solid pattern.  The pattern in
turn calls into xlib's create_solid_surface which returns a dithered
pattern.

This can get into infinite loop right now, because of the way solid
surface cache tries to repaint cached surfaces.
2008-06-19 22:00:52 -04:00
Behdad Esfahbod
abac0f96cb [cairo-xlib-surface] Implement create_solid_pattern_surface
If render is disabled, this will create a surface the size of the
dither pattern and paint it with dithering.
2008-06-19 22:00:50 -04:00
Behdad Esfahbod
fb8f2b3854 [cairo-xlib-surface] Make _draw_image_surface handle arbitrary image formats
This is not a useful change.  Just committing because I already did it.
2008-06-19 21:55:41 -04:00
Behdad Esfahbod
bc4b788ec1 [cairo-xlib-surface] In _get_image_surface only use pixman formats >= 24bpp
Otherwise we can't do dithering.  This drastically improves gradient rendering
on 16bit displays, essentially making them indistinguishable from 32bit ones
with a naked eye.
2008-06-19 21:55:27 -04:00
Behdad Esfahbod
5faf8663b2 [cairo-xlib-surface] Force buggy_repeat to TRUE if Render is not available
So we use more core protocol paths.
2008-06-19 21:54:29 -04:00
Behdad Esfahbod
e7c1fc5bf5 [xlib] Implement dithering
Remove the intermediate rgb333 for PseudoColor and work on the
cube directly.  Also upgrade to a 6x6x6 cube instead of 5x5x5.
Do dithering on both PseudoColor and TrueColor, using a 4x4 pattern.

This only affects X servers with no XRender.
2008-06-19 21:54:23 -04:00
Behdad Esfahbod
c0176dc54c [cairo-xlib-surface] Remove unused macro 2008-06-19 21:54:02 -04:00