summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2010-01-24 22:23:26 +1030
committerAdrian Johnson <ajohnson@redneon.com>2010-01-24 22:40:40 +1030
commitb7550bf0f1cafb5cc5df13da50b0cec80313038f (patch)
tree871ba4b6c6ea6231167f0da9eb995eb32103b14e
parentea7fda442c169a159b2e3c51894a0f5e70a13984 (diff)
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.
-rw-r--r--src/cairo-type3-glyph-surface.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index 5a15153f7..78e8b71c7 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -291,28 +291,17 @@ _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_scale, invert_y_axis;
status = _cairo_surface_clipper_set_clip (&surface->clipper, clip);
if (unlikely (status))
return status;
- 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 (unlikely (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_scale, &scaled_font->scale, &invert_y_axis);
font = cairo_scaled_font_create (scaled_font->font_face,
- &scaled_font->font_matrix,
- &new_ctm,
+ &new_scale,
+ &surface->cairo_to_pdf,
&scaled_font->options);
if (unlikely (font->status))
return font->status;