summaryrefslogtreecommitdiff
path: root/src/cairo-win32-surface.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2008-08-10 14:24:16 +0930
committerAdrian Johnson <ajohnson@redneon.com>2008-08-10 14:24:16 +0930
commit4c8317941815971f1d060243e1f6153df06866ca (patch)
treedf6ecd1c8824d0125e941cd4c33b5c1238c1ddc6 /src/cairo-win32-surface.c
parentb34c248b92b2d1544a23c20ecaa12f64792cb1d3 (diff)
Win32-printing: Fix Type 1 font printing so fallback is not used
Using glyph indices with Type 1 fonts on a printer DC does not work. Previously there was a temporary fix where Type 1 fonts were printed as filled paths. Now that _cairo_scaled_font_subsets_map_glyph() provides the reverse mapping of the glyph index fix this by converting the glyph indices back to the unicode values when printing Type 1 fonts.
Diffstat (limited to 'src/cairo-win32-surface.c')
-rw-r--r--src/cairo-win32-surface.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index d090ffbd..236f0526 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -50,6 +50,7 @@
#include "cairo-clip-private.h"
#include "cairo-paginated-private.h"
#include "cairo-win32-private.h"
+#include "cairo-scaled-font-subsets-private.h"
#include <windows.h>
@@ -359,6 +360,7 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
surface->had_simple_clip = FALSE;
surface->extents = surface->clip_rect;
+ surface->font_subsets = NULL;
_cairo_surface_init (&surface->base, &cairo_win32_surface_backend,
_cairo_content_from_format (format));
@@ -497,6 +499,9 @@ _cairo_win32_surface_finish (void *abstract_surface)
if (surface->initial_clip_rgn)
DeleteObject (surface->initial_clip_rgn);
+ if (surface->font_subsets != NULL)
+ _cairo_scaled_font_subsets_destroy (surface->font_subsets);
+
return CAIRO_STATUS_SUCCESS;
}
@@ -1578,6 +1583,7 @@ _cairo_win32_surface_show_glyphs (void *surface,
int start_x, start_y;
double user_x, user_y;
int logical_x, logical_y;
+ unsigned int glyph_index_option;
/* We can only handle win32 fonts */
if (cairo_scaled_font_get_type (scaled_font) != CAIRO_FONT_TYPE_WIN32)
@@ -1663,10 +1669,24 @@ _cairo_win32_surface_show_glyphs (void *surface,
}
}
+ /* Using glyph indices for a Type 1 font does not work on a
+ * printer DC. The win32 printing surface will convert the the
+ * glyph indices of Type 1 fonts to the unicode values.
+ */
+ if ((dst->flags & CAIRO_WIN32_SURFACE_FOR_PRINTING) &&
+ _cairo_win32_scaled_font_is_type1 (scaled_font))
+ {
+ glyph_index_option = 0;
+ }
+ else
+ {
+ glyph_index_option = ETO_GLYPH_INDEX;
+ }
+
win_result = ExtTextOutW(dst->dc,
start_x,
start_y,
- ETO_GLYPH_INDEX | ETO_PDY,
+ glyph_index_option | ETO_PDY,
NULL,
glyph_buf,
num_glyphs,