From b0c9b985cba225351e884786a08a321b030413c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 14 Apr 2020 10:09:20 +0200 Subject: layout: Ignore setting the width if it won't have any effect This is a pretty weak check (think e.g. a layout containing the text "a\na"), but it's very easy to do and still hits quite a few cases in real-world applications. --- pango/pango-layout.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 44d59367..872ccd71 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -362,6 +362,11 @@ pango_layout_set_width (PangoLayout *layout, if (width != layout->width) { layout->width = width; + + /* Increasing the width can only decrease the line count */ + if (layout->line_count == 1 && width > layout->width) + return; + layout_changed (layout); } } -- cgit v1.2.1