From cd897bf6e3df976cd7ab40c406cd02cb1411cd0d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 18 Aug 2020 23:30:48 -0400 Subject: Avoid a dead assignment As pointed out in #495, we were assigning logical_rect->y twice in a row here. Once is enough. --- pango/fonts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pango/fonts.c b/pango/fonts.c index e83abbbe..1695366b 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1799,7 +1799,7 @@ pango_font_get_glyph_extents (PangoFont *font, } if (logical_rect) { - logical_rect->x = logical_rect->y = 0; + logical_rect->x = 0; logical_rect->y = - PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; logical_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE; logical_rect->width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE; -- cgit v1.2.1 From 0c25ed9998bb5c6f2f8134f4469daca460f76667 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 18 Aug 2020 23:44:21 -0400 Subject: Handle analysis.font being NULL I don't think this is a legitimate concern, but it is faster to add a check than to argue about the use of pango on fontless systems. Fixes: #495 --- pango/pango-layout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 92d858b2..7d5b9b10 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -3609,6 +3609,9 @@ find_hyphen_width (PangoItem *item) hb_font_t *hb_font; hb_codepoint_t glyph; + if (!item->analysis.font) + return 0; + /* This is not technically correct, since * a) we may end up inserting a different hyphen * b) we should reshape the entire run -- cgit v1.2.1