summarylogtreecommitdiffstats
path: root/Use-system-wide-font.patch
blob: 9e8df6e277b0367161c9181646b3d9e2fe78c2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Submodule Telegram/lib_ui contains modified content
diff --git a/Telegram/lib_ui/CMakeLists.txt b/Telegram/lib_ui/CMakeLists.txt
index 687b25f..5243936 100644
--- a/Telegram/lib_ui/CMakeLists.txt
+++ b/Telegram/lib_ui/CMakeLists.txt
@@ -20,7 +20,6 @@ set(style_files
     ui/widgets/widgets.style
 )
 set(qrc_files
-    fonts/fonts.qrc
     qt_conf/linux.qrc
     qt_conf/mac.qrc
     qt_conf/win.qrc
diff --git a/Telegram/lib_ui/ui/style/style_core_font.cpp b/Telegram/lib_ui/ui/style/style_core_font.cpp
index e27850f..d1f45b8 100644
--- a/Telegram/lib_ui/ui/style/style_core_font.cpp
+++ b/Telegram/lib_ui/ui/style/style_core_font.cpp
@@ -15,7 +15,6 @@
 #include <QtGui/QFontDatabase>
 
 void style_InitFontsResource() {
-	Q_INIT_RESOURCE(fonts);
 #ifdef Q_OS_WIN
 	Q_INIT_RESOURCE(win);
 #elif defined Q_OS_MAC // Q_OS_WIN
@@ -133,14 +132,6 @@ enum {
 
 	FontTypesCount,
 };
-QString FontTypeNames[FontTypesCount] = {
-	"DAOpenSansRegular",
-	"DAOpenSansRegularItalic",
-	"DAOpenSansBold",
-	"DAOpenSansBoldItalic",
-	"DAOpenSansSemibold",
-	"DAOpenSansSemiboldItalic",
-};
 int32 FontTypeFlags[FontTypesCount] = {
 	0,
 	FontItalic,
@@ -149,14 +140,6 @@ int32 FontTypeFlags[FontTypesCount] = {
 	0,
 	FontItalic,
 };
-QString FontTypeWindowsFallback[FontTypesCount] = {
-	"Segoe UI",
-	"Segoe UI",
-	"Segoe UI",
-	"Segoe UI",
-	"Segoe UI Semibold",
-	"Segoe UI Semibold",
-};
 
 bool Started = false;
 QString Overrides[FontTypesCount];
@@ -196,42 +179,6 @@ void StartFonts() {
 
 	style_InitFontsResource();
 
-	if (!UseSystemFont) {
-		bool areGood[FontTypesCount] = { false };
-		for (auto i = 0; i != FontTypesCount; ++i) {
-			const auto name = FontTypeNames[i];
-			const auto flags = FontTypeFlags[i];
-			areGood[i] = LoadCustomFont(":/gui/fonts/" + name + ".ttf", name, flags);
-			Overrides[i] = name;
-#ifdef Q_OS_WIN
-			// Attempt to workaround a strange font bug with Open Sans Semibold not loading.
-			// See https://github.com/telegramdesktop/tdesktop/issues/3276 for details.
-			// Crash happens on "options.maxh / _t->_st->font->height" with "division by zero".
-			// In that place "_t->_st->font" is "semiboldFont" is "font(13 "Open Sans Semibold").
-			const auto fallback = FontTypeWindowsFallback[i];
-			if (!areGood[i]) {
-				if (ValidateFont(fallback, flags)) {
-					Overrides[i] = fallback;
-					UI_LOG(("Fonts Info: Using '%1' instead of '%2'.").arg(fallback).arg(name));
-				}
-			}
-			// Disable default fallbacks to Segoe UI, see:
-			// https://github.com/telegramdesktop/tdesktop/issues/5368
-			//
-			//QFont::insertSubstitution(name, fallback);
-#endif // Q_OS_WIN
-		}
-#ifdef Q_OS_MAC
-		auto list = QStringList();
-		list.append(".SF NS Text");
-		list.append("Helvetica Neue");
-		list.append("Lucida Grande");
-		for (const auto &name : FontTypeNames) {
-			QFont::insertSubstitutions(name, list);
-		}
-#endif // Q_OS_MAC
-	}
-
 	if (!CustomMainFont.isEmpty() && ValidateFont(CustomMainFont)) {
 		Overrides[FontTypeRegular] = CustomMainFont;
 		Overrides[FontTypeRegularItalic] = CustomMainFont;