Merge remote-tracking branch 'tdesktop/master' into v2.1.2
This commit is contained in:
commit
a76cb8e35e
4 changed files with 40 additions and 24 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -41,6 +41,7 @@ void InitOnTopPanel(not_null<QWidget*> panel) {
|
|||
Assert([platformWindow isKindOfClass:[NSPanel class]]);
|
||||
|
||||
auto platformPanel = static_cast<NSPanel*>(platformWindow);
|
||||
[platformPanel setBackgroundColor:[NSColor clearColor]];
|
||||
[platformPanel setLevel:NSModalPanelWindowLevel];
|
||||
[platformPanel setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces|NSWindowCollectionBehaviorStationary|NSWindowCollectionBehaviorFullScreenAuxiliary|NSWindowCollectionBehaviorIgnoresCycle];
|
||||
[platformPanel setHidesOnDeactivate:NO];
|
||||
|
|
|
|||
|
|
@ -125,19 +125,17 @@ bool LoadCustomFont(const QString &filePath, const QString &familyName, int flag
|
|||
return ValidateFont(familyName, flags);
|
||||
}
|
||||
|
||||
QString MonospaceFont() {
|
||||
static const auto family = [&]() -> QString {
|
||||
const auto tryFont = [&](const QString &attempt) {
|
||||
[[nodiscard]] QString SystemMonospaceFont() {
|
||||
const auto type = QFontDatabase::FixedFont;
|
||||
return QFontDatabase::systemFont(type).family();
|
||||
}
|
||||
|
||||
bool TryFont(const QString &attempt) {
|
||||
const auto resolved = QFontInfo(QFont(attempt)).family();
|
||||
return !resolved.trimmed().compare(attempt, Qt::CaseInsensitive);
|
||||
};
|
||||
}
|
||||
|
||||
if (tryFont(CustomMonospaceFont)) {
|
||||
return CustomMonospaceFont;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_LINUX
|
||||
if (!UseSystemFont) {
|
||||
[[nodiscard]] QString ManualMonospaceFont() {
|
||||
const auto kTryFirst = std::initializer_list<QString>{
|
||||
"Consolas",
|
||||
"Liberation Mono",
|
||||
|
|
@ -145,15 +143,32 @@ QString MonospaceFont() {
|
|||
"Courier"
|
||||
};
|
||||
for (const auto &family : kTryFirst) {
|
||||
if (tryFont(family)) {
|
||||
if (TryFont(family)) {
|
||||
return family;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !Q_OS_LINUX
|
||||
return QString();
|
||||
}
|
||||
|
||||
const auto type = QFontDatabase::FixedFont;
|
||||
return QFontDatabase::systemFont(type).family();
|
||||
QString MonospaceFont() {
|
||||
static const auto family = [&]() -> QString {
|
||||
if (TryFont(CustomMonospaceFont)) {
|
||||
return CustomMonospaceFont;
|
||||
}
|
||||
|
||||
const auto manual = ManualMonospaceFont();
|
||||
const auto system = SystemMonospaceFont();
|
||||
|
||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||
// Prefer our monospace font.
|
||||
const auto useSystem = manual.isEmpty();
|
||||
#else // Q_OS_WIN || Q_OS_MAC
|
||||
// Prefer system monospace font.
|
||||
const auto metrics = QFontMetrics(QFont(system));
|
||||
const auto useSystem = manual.isEmpty()
|
||||
|| (metrics.charWidth("i", 0) == metrics.charWidth("W", 0));
|
||||
#endif // Q_OS_WIN || Q_OS_MAC
|
||||
return (useSystem || UseSystemFont) ? system : manual;
|
||||
}();
|
||||
|
||||
return family;
|
||||
|
|
@ -367,7 +382,7 @@ FontData::FontData(int size, uint32 flags, int family, Font *other)
|
|||
f.setStrikeOut(_flags & FontStrikeOut);
|
||||
|
||||
if (_flags & FontSemibold) {
|
||||
if (CustomSemiboldIsBold) {
|
||||
if (CustomSemiboldIsBold || fontOverride.startsWith("DAOpenSansSemibold")) {
|
||||
f.setBold(true);
|
||||
#ifdef DESKTOP_APP_USE_PACKAGED_FONTS
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue