Skip to content

Commit

Permalink
Don't try to draw characters which don't exist in current font
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 2, 2019
1 parent 30f1c97 commit 5a57336
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/gui/symbology/characterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.