mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:50:05 +00:00
On macOS, set font pixel size instead of point size to prevent tiny display
This commit is contained in:
parent
9eea0a4dc8
commit
5716d89d52
2 changed files with 12 additions and 0 deletions
|
|
@ -191,7 +191,13 @@ void FontManager::Impl::UpdateQFont(types::FontCategory fontCategory)
|
||||||
QFont font = QFontDatabase::font(QString::fromStdString(family),
|
QFont font = QFontDatabase::font(QString::fromStdString(family),
|
||||||
QString::fromStdString(styles),
|
QString::fromStdString(styles),
|
||||||
static_cast<int>(size.value()));
|
static_cast<int>(size.value()));
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
font.setPointSizeF(size.value());
|
font.setPointSizeF(size.value());
|
||||||
|
#else
|
||||||
|
const units::font_size::pixels<double> pixelSize {size};
|
||||||
|
font.setPixelSize(static_cast<int>(pixelSize.value()));
|
||||||
|
#endif
|
||||||
|
|
||||||
fontCategoryQFontMap_.insert_or_assign(fontCategory, font);
|
fontCategoryQFontMap_.insert_or_assign(fontCategory, font);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1496,6 +1496,12 @@ void SettingsDialogImpl::UpdateFontDisplayData()
|
||||||
self_->ui->fontStyleLabel->setText(font.styleName());
|
self_->ui->fontStyleLabel->setText(font.styleName());
|
||||||
self_->ui->fontSizeLabel->setText(QString::number(font.pointSizeF()));
|
self_->ui->fontSizeLabel->setText(QString::number(font.pointSizeF()));
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
const units::font_size::points<double> fontSize {font.pointSizeF()};
|
||||||
|
const units::font_size::pixels<double> fontPixels {fontSize};
|
||||||
|
font.setPixelSize(static_cast<int>(fontPixels.value()));
|
||||||
|
#endif
|
||||||
|
|
||||||
self_->ui->fontPreviewLabel->setFont(font);
|
self_->ui->fontPreviewLabel->setFont(font);
|
||||||
|
|
||||||
if (selectedFontCategory_ != types::FontCategory::Unknown)
|
if (selectedFontCategory_ != types::FontCategory::Unknown)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue