Skip to content

Commit

Permalink
GUI: Reject invalid fonts
Browse files Browse the repository at this point in the history
Do not set fonts that do not exist, or are not fixed width.
  • Loading branch information
equalsraf committed May 7, 2015
1 parent 445ac31 commit 487e839
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ bool Shell::setGuiFont(const QString& fdesc)
}
}

QFontInfo fi(f);
if (fi.family().compare(f.family(), Qt::CaseInsensitive) != 0 &&
f.family().compare("Monospace", Qt::CaseInsensitive) != 0) {
return false;
}
if ( !fi.fixedPitch() ) {
return false;
}

m_font = f;
m_fm = new QFontMetrics(m_font);

Expand Down

0 comments on commit 487e839

Please sign in to comment.