summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-04-14 10:09:20 +0200
committerTimm Bäder <mail@baedert.org>2020-06-08 19:15:14 +0200
commitb0c9b985cba225351e884786a08a321b030413c3 (patch)
tree2c151f4af291796fae59d85549b725f61d5a238d
parent78499e8154aeab2c4ba54aa0bbea6d6fd42e2897 (diff)
downloadpango-b0c9b985cba225351e884786a08a321b030413c3.tar.gz
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.
-rw-r--r--pango/pango-layout.c5
1 files changed, 5 insertions, 0 deletions
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);
}
}