From 322c6180daf0f81afc397e4dd638e87c1b75c04b Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 25 Jan 2010 21:06:31 +1030 Subject: [PATCH] Fix incorrect font scale and glyph position in Type 3 fonts The PDF file referenced by bug 26186 contains a Type 3 font with non identity font matrix and a "1/2" glyph created by drawing the "1" and "2" from a Type 1 font. This combination exposed a bug in the font scale and glyph position in _cairo_type3_glyph_surface_show_glyphs when printing user font glyphs. --- src/cairo-type3-glyph-surface.c | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c index c84f5f0..109af6b 100644 --- a/src/cairo-type3-glyph-surface.c +++ b/src/cairo-type3-glyph-surface.c @@ -268,19 +268,11 @@ _cairo_type3_glyph_surface_show_glyphs (void *abstract_surface, cairo_type3_glyph_surface_t *surface = abstract_surface; cairo_int_status_t status; cairo_scaled_font_t *font; - cairo_matrix_t new_ctm, ctm_inverse; - int i; + cairo_matrix_t new_ctm, invert_y_axis; - for (i = 0; i < num_glyphs; i++) - cairo_matrix_transform_point (&surface->cairo_to_pdf, &glyphs[i].x, &glyphs[i].y); - - /* We require the matrix to be invertable. */ - ctm_inverse = scaled_font->ctm; - status = cairo_matrix_invert (&ctm_inverse); - if (status) - return CAIRO_INT_STATUS_IMAGE_FALLBACK; - - cairo_matrix_multiply (&new_ctm, &scaled_font->ctm, &ctm_inverse); + cairo_matrix_init_scale (&invert_y_axis, 1, -1); + cairo_matrix_multiply (&new_ctm, &invert_y_axis, &scaled_font->ctm); + cairo_matrix_multiply (&new_ctm, &surface->cairo_to_pdf, &new_ctm); font = cairo_scaled_font_create (scaled_font->font_face, &scaled_font->font_matrix, &new_ctm, -- 1.6.3.3