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

This commit is contained in:
Nyall Dawson 2019-05-02 08:52:48 +10:00
parent 30f1c97341
commit 5a57336880

View File

@ -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 ) ) );
}
}
}
}