Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix stretch setting resets to 0
  • Loading branch information
nyalldawson committed Nov 18, 2021
1 parent e0eda6d commit d99460e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/textrenderer/qgstextformat.cpp
Expand Up @@ -292,7 +292,7 @@ void QgsTextFormat::setOpacity( double opacity )

int QgsTextFormat::stretchFactor() const
{
return d->textFont.stretch();
return d->textFont.stretch() > 0 ? d->textFont.stretch() : 100;
}

void QgsTextFormat::setStretchFactor( int factor )
Expand Down Expand Up @@ -670,7 +670,8 @@ QDomElement QgsTextFormat::writeXml( QDomDocument &doc, const QgsReadWriteContex
textStyleElem.setAttribute( QStringLiteral( "fontKerning" ), d->textFont.kerning() );
textStyleElem.setAttribute( QStringLiteral( "textOpacity" ), d->opacity );
#ifdef HAS_KDE_QT5_FONT_STRETCH_FIX
textStyleElem.setAttribute( QStringLiteral( "stretchFactor" ), d->textFont.stretch() );
if ( d->textFont.stretch() > 0 )
textStyleElem.setAttribute( QStringLiteral( "stretchFactor" ), d->textFont.stretch() );
#endif
textStyleElem.setAttribute( QStringLiteral( "textOrientation" ), QgsTextRendererUtils::encodeTextOrientation( d->orientation ) );
textStyleElem.setAttribute( QStringLiteral( "blendMode" ), QgsPainting::getBlendModeEnum( d->blendMode ) );
Expand Down

0 comments on commit d99460e

Please sign in to comment.