Skip to content

Commit

Permalink
scale size for offset back beforhand when it's evaluated with the fon…
Browse files Browse the repository at this point in the history
…t metrics
  • Loading branch information
signedav committed Jan 7, 2025
1 parent 9c2e316 commit 9506122
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/symbology/qgsmarkersymbollayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3806,9 +3806,11 @@ void QgsFontMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContex
const double sizeToRender = calculateSize( context );
double sizeToCalculateOffsets = sizeToRender;

//if we use the bounds, the font metric boundings are used
if ( mVerticalAnchorMode == VerticalAnchorMode::Bounds )
sizeToCalculateOffsets = mFontMetrics->boundingRect( mString.at( 0 ) ).height() / static_cast<double>( mFontMetrics->ascent() ) * sizeToRender;
{
// when we use the bounds, the font metrics used are already scaled. To be able to deal with this, they should not be scaled, so we scale them back beforehand.
sizeToCalculateOffsets = context.renderContext().convertFromPainterUnits( mFontMetrics->boundingRect( mString.at( 0 ) ).height(), mSizeUnit );
}

bool hasDataDefinedRotation = false;
QPointF offset;
Expand Down

0 comments on commit 9506122

Please sign in to comment.