diff options
author | Carl Worth <cworth@cworth.org> | 2006-04-19 11:04:37 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2006-04-19 11:07:19 -0700 |
commit | c5d5687ac09049ca5b942993fc259e54ad5b6721 (patch) | |
tree | 4c2a139d16b3f4cdcacc0180d317aa92a0e4756d /src | |
parent | ab2546009ff246bd0e7bbc07437330cf307e00f7 (diff) |
PDF: Add simple implementation of _cairo_pdf_surface_show_glyphs (text as paths).
This isn't very exciting text output---it simply turns every call to
cairo_show_glyphs into a single filled path. But at the very least,
text will no longer trigger image fallbacks for the PDF backend.
With this commit, the following tests change from all-fallback to
all-native for the PDF backend:
show-text-current-point
text-antialias-gray
text-antialias-none
text-antialias-subpixel
text-cache-crash
text-rotate
There are rasterization differences in the output (cairo vs. freetype)
so this commit also adds new PDF-specific reference images for some of
those tests so that the suite continues to report PASS.
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-pdf-surface.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 64b564180..8c2252aa3 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -41,6 +41,7 @@ #include "cairo-font-subset-private.h" #include "cairo-ft-private.h" #include "cairo-paginated-surface-private.h" +#include "cairo-path-fixed-private.h" #include <time.h> #include <zlib.h> @@ -2342,13 +2343,33 @@ _cairo_pdf_surface_show_glyphs (void *abstract_surface, cairo_scaled_font_t *scaled_font) { cairo_pdf_surface_t *surface = abstract_surface; + cairo_pdf_document_t *document = surface->document; + cairo_path_fixed_t path; + cairo_status_t status; if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) - return CAIRO_INT_STATUS_UNSUPPORTED; + return _analyze_operation (surface, op, source); - ASSERT_NOT_REACHED; + assert (_operation_supported (surface, op, source)); - return CAIRO_INT_STATUS_UNSUPPORTED; + status = emit_pattern (surface, source); + if (status) + return status; + + /* After emitting the pattern the current stream should belong to + * this surface, so no need to _cairo_pdf_surface_ensure_stream() + */ + assert (document->current_stream != NULL && + document->current_stream == surface->current_stream); + + _cairo_path_fixed_init (&path); + _cairo_scaled_font_glyph_path (scaled_font, glyphs, num_glyphs, &path); + status = _cairo_pdf_surface_fill (surface, op, source, + &path, CAIRO_FILL_RULE_WINDING, + 0.1, scaled_font->options.antialias); + _cairo_path_fixed_fini (&path); + + return status; } static void |