diff --git a/python/core/qgspallabeling.sip b/python/core/qgspallabeling.sip index 77f0b07b41b..799fbbae4ef 100644 --- a/python/core/qgspallabeling.sip +++ b/python/core/qgspallabeling.sip @@ -639,7 +639,7 @@ class QgsPalLayerSettings * @param mapUnitScale a mapUnitScale clamper * @return font pixel size */ - int sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const; + double sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const; /** Calculates size (considering output size should be in pixel or map units, scale factors and optionally oversampling) * @param size size to convert diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index 382e8ebf692..16fcdee4824 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -2223,7 +2223,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont return; } - int fontPixelSize = sizeToPixel( fontSize, context, fontunits, true, fontSizeMapUnitScale ); + int fontPixelSize = qRound( sizeToPixel( fontSize, context, fontunits, true, fontSizeMapUnitScale ) ); // don't try to show font sizes less than 1 pixel (Qt complains) if ( fontPixelSize < 1 ) { @@ -3874,9 +3874,9 @@ void QgsPalLayerSettings::parseDropShadow( QgsRenderContext &context ) dataDefinedValEval( DDBlendMode, QgsPalLayerSettings::ShadowBlendMode, exprVal, context.expressionContext() ); } -int QgsPalLayerSettings::sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor, const QgsMapUnitScale& mapUnitScale ) const +double QgsPalLayerSettings::sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor, const QgsMapUnitScale& mapUnitScale ) const { - return static_cast< int >( scaleToPixelContext( size, c, unit, rasterfactor, mapUnitScale ) + 0.5 ); + return scaleToPixelContext( size, c, unit, rasterfactor, mapUnitScale ) + 0.5; } double QgsPalLayerSettings::scaleToPixelContext( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor, const QgsMapUnitScale& mapUnitScale ) const diff --git a/src/core/qgspallabeling.h b/src/core/qgspallabeling.h index 85a05e9b511..77dee9b5ffc 100644 --- a/src/core/qgspallabeling.h +++ b/src/core/qgspallabeling.h @@ -625,7 +625,7 @@ class CORE_EXPORT QgsPalLayerSettings * @param mapUnitScale a mapUnitScale clamper * @return font pixel size */ - int sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const; + double sizeToPixel( double size, const QgsRenderContext& c, SizeUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ) const; /** Calculates size (considering output size should be in pixel or map units, scale factors and optionally oversampling) * @param size size to convert