mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 10:04:46 -07:00
mess with the font rendering of the home screen until it works (#6563)
* mess with the font rendering of the home screen until it works * add more fonts
This commit is contained in:
parent
49e6cf95c4
commit
92f02fa4ee
1 changed files with 5 additions and 7 deletions
|
|
@ -41,6 +41,8 @@ QString HomeStyledButton::generateButtonStylesheet(const QPair<QColor, QColor> &
|
||||||
return QString(R"(
|
return QString(R"(
|
||||||
QPushButton {
|
QPushButton {
|
||||||
font-size: 34px;
|
font-size: 34px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-family: sans-serif, "Segoe UI", "Helvetica Neue";
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
color: white;
|
color: white;
|
||||||
border: 2px solid %1;
|
border: 2px solid %1;
|
||||||
|
|
@ -88,16 +90,12 @@ void HomeStyledButton::paintEvent(QPaintEvent *event)
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
painter.setRenderHint(QPainter::TextAntialiasing);
|
painter.setRenderHint(QPainter::TextAntialiasing);
|
||||||
|
|
||||||
QFont font = this->font();
|
QFontMetrics fm(font());
|
||||||
font.setBold(true);
|
QSize textSize = fm.size(Qt::TextSingleLine, text());
|
||||||
painter.setFont(font);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
|
||||||
QSize textSize = fm.size(Qt::TextSingleLine, this->text());
|
|
||||||
QPointF center((width() - textSize.width()) / 2.0, (height() + textSize.height() / 2.0) / 2.0);
|
QPointF center((width() - textSize.width()) / 2.0, (height() + textSize.height() / 2.0) / 2.0);
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addText(center, font, this->text());
|
path.addText(center, font(), text());
|
||||||
|
|
||||||
painter.setPen(QPen(Qt::black, 2.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, 2.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush(Qt::white);
|
painter.setBrush(Qt::white);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue