Get rid of redudant fontconfig hack

This commit is contained in:
Ilya Fedin 2020-08-07 10:07:43 +04:00 committed by John Preston
parent f56af090e0
commit 580e6baee6
6 changed files with 0 additions and 108 deletions

View File

@ -53,11 +53,9 @@ void UiIntegration::activationFromTopPanel() {
}
void UiIntegration::startFontsBegin() {
Platform::FallbackFontConfigCheckBegin();
}
void UiIntegration::startFontsEnd() {
Platform::FallbackFontConfigCheckEnd();
}
std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(

View File

@ -209,71 +209,6 @@ bool RunShellCommand(const QString &program, const QStringList &arguments) {
return true;
}
[[nodiscard]] bool CheckFontConfigCrash() {
return InSnap();
}
[[nodiscard]] QString FallbackFontConfigCheckPath() {
return cWorkingDir() + "tdata/fc-check";
}
#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK
[[nodiscard]] bool BadFontConfigVersion() {
if (CheckFontConfigCrash()) {
return QFile(FallbackFontConfigCheckPath()).exists();
}
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.start("fc-list", QStringList() << "--version");
process.waitForFinished();
if (process.exitCode() > 0) {
LOG(("App Error: Could not start fc-list. Process exited with code: %1.").arg(process.exitCode()));
return false;
}
QString result(process.readAllStandardOutput());
DEBUG_LOG(("Fontconfig version string: ") + result);
QVersionNumber version = QVersionNumber::fromString(result.split("version ").last());
if (version.isNull()) {
LOG(("App Error: Could not get version from fc-list output."));
return false;
}
LOG(("Fontconfig version: %1.").arg(version.toString()));
if (version < QVersionNumber::fromString("2.13")) {
if (!qEnvironmentVariableIsSet("TDESKTOP_FORCE_CUSTOM_FONTCONFIG")) {
return false;
}
}
return true;
}
void FallbackFontConfig() {
const auto custom = cWorkingDir() + "tdata/fc-custom-1.conf";
auto doFallback = [&] {
if (QFile(custom).exists()) {
LOG(("Custom FONTCONFIG_FILE: ") + custom);
qputenv("FONTCONFIG_FILE", QFile::encodeName(custom));
return true;
}
return false;
};
if (doFallback()) {
return;
}
if (BadFontConfigVersion()) {
QFile(":/fc/fc-custom.conf").copy(custom);
doFallback();
}
}
#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK
bool GenerateDesktopFile(
const QString &targetPath,
const QString &args,
@ -965,23 +900,6 @@ void SetTrayIconSupported(bool supported) {
IsTrayIconSupported = supported;
}
void FallbackFontConfigCheckBegin() {
if (!CheckFontConfigCrash()) {
return;
}
auto file = QFile(FallbackFontConfigCheckPath());
if (file.open(QIODevice::WriteOnly)) {
file.write("1", 1);
}
}
void FallbackFontConfigCheckEnd() {
if (!CheckFontConfigCrash()) {
return;
}
QFile(FallbackFontConfigCheckPath()).remove();
}
bool StartSystemMove(QWindow *window) {
if (IsWayland()) {
return StartWaylandMove(window);
@ -1178,10 +1096,6 @@ void start() {
LOG(("Launcher filename: %1").arg(GetLauncherFilename()));
#ifdef TDESKTOP_USE_FONTCONFIG_FALLBACK
FallbackFontConfig();
#endif // TDESKTOP_USE_FONTCONFIG_FALLBACK
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());

View File

@ -42,9 +42,6 @@ QString GetIconName();
inline void IgnoreApplicationActivationRightNow() {
}
void FallbackFontConfigCheckBegin();
void FallbackFontConfigCheckEnd();
bool GtkClipboardSupported();
void SetTrayIconSupported(bool supported);
void InstallMainDesktopFile();

View File

@ -20,12 +20,6 @@ void RemoveQuarantine(const QString &path);
[[nodiscard]] bool IsDarkMenuBar();
inline void FallbackFontConfigCheckBegin() {
}
inline void FallbackFontConfigCheckEnd() {
}
inline QImage GetImageFromClipboard() {
return {};
}

View File

@ -22,12 +22,6 @@ inline void SetWatchingMediaKeys(bool watching) {
inline void IgnoreApplicationActivationRightNow() {
}
inline void FallbackFontConfigCheckBegin() {
}
inline void FallbackFontConfigCheckEnd() {
}
inline QImage GetImageFromClipboard() {
return {};
}

View File

@ -4,7 +4,6 @@
# For license and copyright information please follow this link:
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
option(TDESKTOP_USE_FONTCONFIG_FALLBACK "Use custom fonts.conf (Linux only)." OFF)
option(TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME "Disable automatic 'tg://' URL scheme handler registration." OFF)
option(TDESKTOP_DISABLE_NETWORK_PROXY "Disable all code for working through Socks5 or MTProxy." OFF)
option(TDESKTOP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF)
@ -56,10 +55,6 @@ if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA)
endif()
if (TDESKTOP_USE_FONTCONFIG_FALLBACK)
target_compile_definitions(Telegram PRIVATE TDESKTOP_USE_FONTCONFIG_FALLBACK)
endif()
if (TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME)
endif()