Use default font in window title on macOS.

This commit is contained in:
John Preston 2022-01-17 15:04:28 +03:00
parent 220d683528
commit 79d2052a83

View file

@ -9,6 +9,7 @@
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
#include "base/debug_log.h"
#include "styles/style_widgets.h" #include "styles/style_widgets.h"
#include "styles/palette.h" #include "styles/palette.h"
@ -59,20 +60,29 @@ void TitleWidget::init(int height) {
}, lifetime()); }, lifetime());
const auto families = QStringList{ const auto families = QStringList{
QString(".SF NS Text"), u".AppleSystemUIFont"_q,
QString("Helvetica Neue") u".SF NS Text"_q,
u"Helvetica Neue"_q,
}; };
for (auto family : families) { for (auto family : families) {
_font.setFamily(family); _font.setFamily(family);
if (QFontInfo(_font).family() == _font.family()) { if (QFontInfo(_font).family() == _font.family()) {
static const auto logged = [&] {
LOG(("Title Font: %1").arg(family));
return true;
}();
break; break;
} }
} }
if (QFontInfo(_font).family() == _font.family()) { if (QFontInfo(_font).family() != _font.family()) {
_font.setPixelSize((height * 15) / 24); _font = st::semiboldFont;
_font.setPixelSize(13);
} else if (_font.family() == u".AppleSystemUIFont"_q) {
_font.setBold(true);
_font.setPixelSize(13);
} else { } else {
_font = st::normalFont; _font.setPixelSize((height * 15) / 24);
} }
} }