Skip to content
Permalink
Browse files

[labeling] Fix incorrect handling of word spacing for curved labels

  • Loading branch information
nyalldawson authored and jef-n committed Jul 22, 2015
1 parent 1583924 commit e0b244558608dd144a3f4c9d3c8ba0c55c4fd359
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/core/qgspalgeometry.h
@@ -117,11 +117,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;
}

@@ -172,10 +176,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;

0 comments on commit e0b2445

Please sign in to comment.
You can’t perform that action at this time.