Skip to content
Permalink
Browse files

Scaled font also needs to scale letter/word spacing

  • Loading branch information
nyalldawson committed Jul 10, 2020
1 parent 58e31fd commit b449361c1058a9a6d304356462f86239fe6cc58a
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/textrenderer/qgstextformat.cpp
@@ -77,9 +77,11 @@ QFont QgsTextFormat::scaledFont( const QgsRenderContext &context, double scaleFa
{
double fontPixelSize = context.convertToPainterUnits( d->fontSize, d->fontSizeUnits, d->fontSizeMapUnitScale );
font.setPixelSize( std::round( scaleFactor * fontPixelSize + 0.5 ) );
font.setLetterSpacing( QFont::AbsoluteSpacing, d->textFont.letterSpacing() * scaleFactor );
font.setWordSpacing( d->textFont.wordSpacing() * scaleFactor );
}

font.setLetterSpacing( QFont::AbsoluteSpacing, context.convertToPainterUnits( d->textFont.letterSpacing(), d->fontSizeUnits, d->fontSizeMapUnitScale ) * scaleFactor );
font.setWordSpacing( context.convertToPainterUnits( d->textFont.wordSpacing(), d->fontSizeUnits, d->fontSizeMapUnitScale ) * scaleFactor * scaleFactor );

return font;
}

0 comments on commit b449361

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