Commit graph

5402 commits

Author SHA1 Message Date
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
Adrian Johnson
0c05aa60f5 PDF: Limit precision of Td operands
As the translation is in text space, the full precision of a double
for numbers close to zero is not required. Limit the precision to the
same as for numbers > 1.
2008-07-08 21:12:28 +09:30
Adrian Johnson
d5c7b87ca9 PDF: Ensure clip is not emitted outside of stream
Sylvain Munaut discovered a bug in
_cairo_pdf_surface_emit_meta_surface() where the clip may be emitted
after the stream is closed. Fix this by moving the call to
_cairo_surface_set_clip() to before the stream is closed.
2008-07-08 20:57:57 +09:30
Adrian Johnson
130cd29a70 PDF: remove meta surface group clean
The group that was being cleaned up was removed in
099810b6c3
2008-07-08 20:55:38 +09:30
Chris Wilson
fe7973d60a [cairo-scaled-font-subsets] Fix memleak.
Valgrind reported that sub_font_glyph->utf8 was not being freed along
with the cairo_sub_font_glyph_t.
2008-07-06 15:16:30 +01:00
Chris Wilson
07b39ee3c0 [cairo-scaled-font-subsets] Fix use of unitialised variable.
Valgrind reported that pdf-operators tried to use an uninitialised
subset_glyph->utf8_is_mapped.
2008-07-06 15:14:22 +01:00
Adrian Johnson
f92131c38a PS: Remember current color
This allows PDF operators to merge text strings together when they are
all the same color.
2008-07-05 16:23:43 +09:30
Adrian Johnson
dac22cf2b9 PDF: Fix glyph positioning bug in Tj operator
Previously this was not correctly checking the position of the first
glyph and falling back to using TJ if the glyph was not at the the
standard glyph advance.
2008-07-05 16:22:35 +09:30
Adrian Johnson
c9c4b0eded PDF: Fix glyph positioning bug in TJ operator
Previously this was not correctly positioning the first glyph in a TJ
string if the glyph was not at the the standard glyph advance.
2008-07-05 16:19:30 +09:30
Adrian Johnson
0f748df670 PS: Remember position when changing font
Previously the PS emulation of the PDF operators would change the
current position to the text line matrix instead of the the text
matrix when changing the font.
2008-07-05 16:14:31 +09:30
Behdad Esfahbod
1c729f85ed [cairo-pattern] Fix crash in solid-pattern-surface cache
Ickle knew something when he only extended cache size when we are
committed to inserting something into the cache.  I broke that while
fixing other issues a while ago.  This cache just doesn't want to
give us any rest...
2008-07-03 19:15:53 -04:00
Behdad Esfahbod
7c9536b653 [analysis-surface] Fix crashers introduced in my previous commit
Oops!
2008-07-03 18:06:01 -04:00
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