Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ensure text format previews are antialiased
  • Loading branch information
nyalldawson committed Jul 7, 2020
1 parent f89fb2a commit 546777f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/textrenderer/qgstextformat.cpp
Expand Up @@ -821,6 +821,7 @@ QPixmap QgsTextFormat::textFormatPreviewPixmap( const QgsTextFormat &format, QSi

context.setScaleFactor( QgsApplication::desktop()->logicalDpiX() / 25.4 );
context.setUseAdvancedEffects( true );
context.setFlag( QgsRenderContext::Antialiasing, true );
context.setPainter( &painter );

// slightly inset text to account for buffer/background
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsfontbutton.cpp
Expand Up @@ -867,6 +867,7 @@ void QgsFontButton::updatePreview( const QColor &color, QgsTextFormat *format, Q

context.setScaleFactor( QgsApplication::desktop()->logicalDpiX() / 25.4 );
context.setUseAdvancedEffects( true );
context.setFlag( QgsRenderContext::Antialiasing, true );
context.setPainter( &p );

// slightly inset text to account for buffer/background
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgstextpreview.cpp
Expand Up @@ -30,6 +30,8 @@ QgsTextPreview::QgsTextPreview( QWidget *parent )
mContext.setScaleFactor( QgsApplication::desktop()->logicalDpiX() / 25.4 );
mContext.setUseAdvancedEffects( true );

mContext.setFlag( QgsRenderContext::Antialiasing, true );

mContext.setIsGuiPreview( true );
}

Expand Down

0 comments on commit 546777f

Please sign in to comment.