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
  • Loading branch information
nyalldawson committed May 30, 2019
1 parent e227e93 commit e1bd4e9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/pal/feature.cpp
Expand Up @@ -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<LabelPosition *> positions;
double delta = std::max( li->label_height, total_distance / mLF->layer()->pal->line_p );

Expand Down

0 comments on commit e1bd4e9

Please sign in to comment.