diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-05-09 01:31:58 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-05-09 01:31:58 +0000 |
commit | 4dcd060cc51c0ff954db365f06ac117d90c0443b (patch) | |
tree | 287afc250eabf5c188b3f8c4e8b42347acb9e159 /pango/pango-renderer.c | |
parent | 73b46b04c724335ad73534cc69955baa2388b861 (diff) | |
parent | 5f2a5bbc95363ba25a6a7c107cd7daf260167e8b (diff) | |
download | pango-1-44.tar.gz |
Merge branch 'pango-1-44' into 'pango-1-44'pango-1-44
[1.44] Cherry pick various upstream fixes
See merge request GNOME/pango!321
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r-- | pango/pango-renderer.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 889989dd..5e98fd16 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -974,15 +974,22 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer, int width, int height) { - int square = height / HEIGHT_SQUARES; - int unit_width = (HEIGHT_SQUARES - 1) * square; - int width_units = (width + unit_width / 2) / unit_width; + int square; + int unit_width; + int width_units; const PangoMatrix identity = PANGO_MATRIX_INIT; const PangoMatrix *matrix; double dx, dx0, dy0; PangoMatrix total; int i; + if (width <= 0 || height <= 0) + return; + + square = height / HEIGHT_SQUARES; + unit_width = (HEIGHT_SQUARES - 1) * square; + width_units = (width + unit_width / 2) / unit_width; + x += (width - width_units * unit_width) / 2; if (renderer->matrix) |