From e1bd4e921018542671aa70eb626fbf33d7e2acb1 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 28 May 2019 14:52:34 +1000 Subject: [PATCH] [labeling] Don't waste time trying to generate curved labels on lines where the label length is greater then the line length --- src/core/pal/feature.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index c2fd59bc005..053debf1792 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -1173,6 +1173,18 @@ int FeaturePart::createCurvedCandidatesAlongLine( QList< LabelPosition * > &lPos return 0; } + double totalCharacterWidth = 0; + for ( int i = 0; i < li->char_num; ++i ) + totalCharacterWidth += li->char_info[ i ].width; + + if ( totalCharacterWidth > total_distance ) + { + // label doesn't fit on this line, don't waste time trying to make candidates + // TODO - in future allow this, and allow label to overlap end of line + delete[] path_distances; + return 0; + } + QLinkedList positions; double delta = std::max( li->label_height, total_distance / mLF->layer()->pal->line_p );