Skip to content
Permalink
Browse files

Don't try to draw characters which don't exist in current font

  • Loading branch information
nyalldawson committed May 1, 2019
1 parent 30f1c97 commit 5a57336880768d9aba16ee46709e125f79160d55
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/gui/symbology/characterwidget.cpp
@@ -247,9 +247,12 @@ void CharacterWidget::paintEvent( QPaintEvent *event )
if ( key == mLastKey )
painter.fillRect( column * mSquareSize + 1, row * mSquareSize + 1, mSquareSize, mSquareSize, QBrush( palette.color( QPalette::Highlight ) ) );

painter.drawText( column * mSquareSize + ( mSquareSize / 2 ) - fontMetrics.width( QChar( key ) ) / 2,
row * mSquareSize + 4 + fontMetrics.ascent(),
QString( QChar( key ) ) );
if ( fontMetrics.inFont( QChar( key ) ) )
{
painter.drawText( column * mSquareSize + ( mSquareSize / 2 ) - fontMetrics.width( QChar( key ) ) / 2,
row * mSquareSize + 4 + fontMetrics.ascent(),
QString( QChar( key ) ) );
}
}
}
}

0 comments on commit 5a57336

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