diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-28 12:57:17 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-28 12:57:17 +0000 |
commit | 3fdbd3fe01842e683a26a1e1c9c9eb04099f27f1 (patch) | |
tree | 98a297eaad6bc3b6c2d59e531639650d470887cf | |
parent | 24ca0e22b8038eba7c558eb19f593dfc4892aa55 (diff) | |
parent | d5c3348ac714d884cb6be8d04f0e1b96f04d59c9 (diff) | |
download | pango-3fdbd3fe01842e683a26a1e1c9c9eb04099f27f1.tar.gz |
Merge branch 'gravity-fixes' into 'main'
Fix misplaced glyphs in gravity east
Closes #631
See merge request GNOME/pango!524
-rw-r--r-- | pango/pango-layout.c | 2 | ||||
-rw-r--r-- | pango/shape.c | 5 | ||||
-rw-r--r-- | tests/layouts/valid-20.layout | 8 |
3 files changed, 9 insertions, 6 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 40e24cbb..7b32eeef 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -5664,7 +5664,7 @@ pango_layout_line_get_extents_and_height (PangoLayoutLine *line, } if (height) - *height = MAX (*height, run_height); + *height = MAX (*height, abs (run_height)); x_pos += run_logical.width; tmp_list = tmp_list->next; diff --git a/pango/shape.c b/pango/shape.c index afb1e1a3..caefeae4 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -169,7 +169,10 @@ pango_hb_font_get_glyph_v_advance (hb_font_t *font, pango_font_get_glyph_extents (context->font, glyph, NULL, &logical); - return logical.height; + if (hb_font_get_glyph_v_advance (context->parent, glyph) < 0) + return - logical.height; + else + return logical.height; } static hb_bool_t diff --git a/tests/layouts/valid-20.layout b/tests/layouts/valid-20.layout index 47a9c6dc..7c00d5dc 100644 --- a/tests/layouts/valid-20.layout +++ b/tests/layouts/valid-20.layout @@ -15,7 +15,7 @@ 0.0 ] }, - "comment" : "", + "comment" : "mixed gravity fun", "text" : "abcdef", "attributes" : [ { @@ -139,7 +139,7 @@ { "glyph" : 244, "width" : 19456, - "x-offset" : 34220, + "x-offset" : 14764, "y-offset" : 3844, "is-cluster-start" : true, "log-cluster" : 0 @@ -147,7 +147,7 @@ { "glyph" : 272, "width" : 19456, - "x-offset" : 34220, + "x-offset" : 14764, "y-offset" : 4280, "is-cluster-start" : true, "log-cluster" : 1 @@ -155,7 +155,7 @@ { "glyph" : 273, "width" : 19456, - "x-offset" : 34220, + "x-offset" : 14764, "y-offset" : 3506, "is-cluster-start" : true, "log-cluster" : 2 |