mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-27 00:07:16 -05:00
[layouts] Stabilise text metrics
Apply font scaling workaround to avoid unpredictable font metrics when zooming in/out of layout
This commit is contained in:
parent
c67cf40580
commit
1711ee4645
@ -157,6 +157,7 @@ void QgsLayoutItemLegend::paint( QPainter *painter, const QStyleOptionGraphicsIt
|
||||
{
|
||||
QgsRenderContext context = mMap ? QgsLayoutUtils::createRenderContextForMap( mMap, painter )
|
||||
: QgsLayoutUtils::createRenderContextForLayout( mLayout, painter );
|
||||
context.setFlag( Qgis::RenderContextFlag::ApplyScalingWorkaroundForTextRendering );
|
||||
|
||||
const QSizeF size = legendRenderer.minimumSize( &context );
|
||||
if ( mForceResize )
|
||||
@ -236,6 +237,7 @@ void QgsLayoutItemLegend::draw( QgsLayoutItemRenderContext &context )
|
||||
: QgsLayoutUtils::createRenderContextForLayout( mLayout, painter, context.renderContext().scaleFactor() * 25.4 );
|
||||
|
||||
rc.expressionContext().appendScopes( createExpressionContext().takeScopes() );
|
||||
rc.setFlag( Qgis::RenderContextFlag::ApplyScalingWorkaroundForTextRendering );
|
||||
|
||||
const QgsScopedQPainterState painterState( painter );
|
||||
|
||||
@ -281,6 +283,7 @@ void QgsLayoutItemLegend::adjustBoxSize()
|
||||
|
||||
QgsRenderContext context = mMap ? QgsLayoutUtils::createRenderContextForMap( mMap, nullptr ) :
|
||||
QgsLayoutUtils::createRenderContextForLayout( mLayout, nullptr );
|
||||
context.setFlag( Qgis::RenderContextFlag::ApplyScalingWorkaroundForTextRendering );
|
||||
|
||||
QgsLegendRenderer legendRenderer = createRenderer();
|
||||
const QSizeF size = legendRenderer.minimumSize( &context );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user