Skip to content

Commit

Permalink
[labeling] Don't waste time trying to generate curved labels on lines
Browse files Browse the repository at this point in the history
where the label length is greater then the line length

(cherry picked from commit e1bd4e9)
  • Loading branch information
nyalldawson committed Jun 10, 2019
1 parent 5635c4f commit 9f92a01
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/pal/feature.cpp
Expand Up @@ -1181,6 +1181,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<LabelPosition *> positions;
double delta = std::max( li->label_height, total_distance / mLF->layer()->pal->line_p );

Expand Down

0 comments on commit 9f92a01

Please sign in to comment.