mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 17:18:42 +02:00
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.
This commit is contained in:
parent
ea7fda442c
commit
b7550bf0f1
1 changed files with 5 additions and 16 deletions
|
|
@ -291,28 +291,17 @@ _cairo_type3_glyph_surface_show_glyphs (void *abstract_surface,
|
||||||
cairo_type3_glyph_surface_t *surface = abstract_surface;
|
cairo_type3_glyph_surface_t *surface = abstract_surface;
|
||||||
cairo_int_status_t status;
|
cairo_int_status_t status;
|
||||||
cairo_scaled_font_t *font;
|
cairo_scaled_font_t *font;
|
||||||
cairo_matrix_t new_ctm, ctm_inverse;
|
cairo_matrix_t new_scale, invert_y_axis;
|
||||||
int i;
|
|
||||||
|
|
||||||
status = _cairo_surface_clipper_set_clip (&surface->clipper, clip);
|
status = _cairo_surface_clipper_set_clip (&surface->clipper, clip);
|
||||||
if (unlikely (status))
|
if (unlikely (status))
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
for (i = 0; i < num_glyphs; i++) {
|
cairo_matrix_init_scale (&invert_y_axis, 1, -1);
|
||||||
cairo_matrix_transform_point (&surface->cairo_to_pdf,
|
cairo_matrix_multiply (&new_scale, &scaled_font->scale, &invert_y_axis);
|
||||||
&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);
|
|
||||||
font = cairo_scaled_font_create (scaled_font->font_face,
|
font = cairo_scaled_font_create (scaled_font->font_face,
|
||||||
&scaled_font->font_matrix,
|
&new_scale,
|
||||||
&new_ctm,
|
&surface->cairo_to_pdf,
|
||||||
&scaled_font->options);
|
&scaled_font->options);
|
||||||
if (unlikely (font->status))
|
if (unlikely (font->status))
|
||||||
return font->status;
|
return font->status;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue