Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[labeling] Fix incorrect handling of word spacing for curved labels
  • Loading branch information
nyalldawson committed Jul 22, 2015
1 parent a1a8d1b commit c8dcf97
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/qgspalgeometry.h
Expand Up @@ -110,11 +110,15 @@ class QgsPalGeometry : public PalGeometry
int nxt = i + 1;
wordSpaceFix = ( nxt < mClusters.count() && mClusters[nxt] != QString( " " ) ) ? mWordSpacing : qreal( 0.0 );
}
if ( fm->width( QString( mClusters[i] ) ) - fm->width( mClusters[i] ) - mLetterSpacing != qreal( 0.0 ) )
// this workaround only works for clusters with a single character. Not sure how it should be handled
// with multi-character clusters.
if ( mClusters[i].length() == 1 &&
!qgsDoubleNear( fm->width( QString( mClusters[i].at( 0 ) ) ), fm->width( mClusters[i].at( 0 ) ) + mLetterSpacing ) )
{
// word spacing applied when it shouldn't be
wordSpaceFix -= mWordSpacing;
}

charWidth = fm->width( QString( mClusters[i] ) ) + wordSpaceFix;
}

Expand Down Expand Up @@ -165,10 +169,10 @@ class QgsPalGeometry : public PalGeometry
qreal mLetterSpacing; // for use with curved labels
qreal mWordSpacing; // for use with curved labels
bool mCurvedLabeling; // whether the geometry is to be used for curved labeling placement
/**Stores attribute values for data defined properties*/
/** Stores attribute values for data defined properties*/
QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > mDataDefinedValues;

/**Stores attribute values for diagram rendering*/
/** Stores attribute values for diagram rendering*/
QgsAttributes mDiagramAttributes;

QString mDxfLayer;
Expand Down

0 comments on commit c8dcf97

Please sign in to comment.