diff options
author | Matthias Clasen <mclasen@redhat.com> | 2023-02-20 21:03:00 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2023-02-20 21:03:00 -0500 |
commit | edc0886df60741ecd3704c1df5f1f9fd2469c13e (patch) | |
tree | 9c92f54805630cfa29bdcf99f118fd36dbfab49c /pango | |
parent | 8e506ba769cc8cc356d61f090f71bbb1a3b12037 (diff) | |
download | pango-edc0886df60741ecd3704c1df5f1f9fd2469c13e.tar.gz |
cairo: Don't mis-scale metricsfix-underline-scale
When metrics were ported to hb, we overlooked that
the scaling done by cairo on the base metrics is
no longer necessary. This was causing underlines
and strikethroughs to be too small when rendering
in a scaled context.
Thanks to Behdad for help in tracking this down.
Fixes: #730
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pangocairo-font.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 598065c0..24bb325b 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -248,9 +248,6 @@ _pango_cairo_font_get_metrics (PangoFont *font, PangoRectangle extents; PangoFontDescription *desc; cairo_scaled_font_t *scaled_font; - cairo_matrix_t cairo_matrix; - PangoMatrix pango_matrix; - PangoMatrix identity = PANGO_MATRIX_INIT; glong sample_str_width; int height, shift; @@ -279,32 +276,6 @@ _pango_cairo_font_get_metrics (PangoFont *font, info->metrics = (* PANGO_CAIRO_FONT_GET_IFACE (font)->create_base_metrics_for_context) (cfont, context); - /* We now need to adjust the base metrics for ctm */ - cairo_scaled_font_get_ctm (scaled_font, &cairo_matrix); - pango_matrix.xx = cairo_matrix.xx; - pango_matrix.yx = cairo_matrix.yx; - pango_matrix.xy = cairo_matrix.xy; - pango_matrix.yy = cairo_matrix.yy; - pango_matrix.x0 = 0; - pango_matrix.y0 = 0; - if (G_UNLIKELY (0 != memcmp (&identity, &pango_matrix, 4 * sizeof (double)))) - { - double xscale = pango_matrix_get_font_scale_factor (&pango_matrix); - if (xscale) xscale = 1 / xscale; - - info->metrics->ascent *= xscale; - info->metrics->descent *= xscale; - info->metrics->height *= xscale; - info->metrics->underline_position *= xscale; - info->metrics->underline_thickness *= xscale; - info->metrics->strikethrough_position *= xscale; - info->metrics->strikethrough_thickness *= xscale; - } - - /* Set the matrix on the context so we don't have to adjust the derived - * metrics. */ - pango_context_set_matrix (context, &pango_matrix); - /* Ugly. We need to prevent recursion when we call into * PangoLayout to determine approximate char width. */ |