mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-13 10:50:28 +01: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_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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue