Skip to content

Commit 56c5690

Browse files
committed
Added inter as the default font and open dyslexic as an alternative
1 parent 9c1fa8f commit 56c5690

File tree

8 files changed

+75
-12
lines changed

8 files changed

+75
-12
lines changed

app/main.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ auto main(int argc, char *argv[]) -> int
101101
QGuiApplication::setWindowIcon(QIcon(u":/resources/icons/icon.png"_s));
102102
setPalette();
103103

104-
#if defined(Q_OS_WIN)
105-
QGuiApplication::setFont(QFont("Segoe UI"));
106-
#endif // if defined(Q_OS_WIN)
104+
QFontDatabase::addApplicationFont(u":/resources/fonts/Inter-Regular.ttf"_s);
105+
QFontDatabase::addApplicationFont(u":/resources/fonts/OpenDyslexic3-Regular.ttf"_s);
106+
QGuiApplication::setFont(QFont(SettingsManager::instance()->get("font", u"Inter"_s)));
107+
QObject::connect(Quick::SettingsManager::instance(), &Quick::SettingsManager::fontChanged, &app,
108+
[](const QString &font) { QGuiApplication::setFont(QFont(font)); });
107109

108110
const Logger logger;
109111

app/ui/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ qt_add_resources(gm-companion-ui "ui-resources"
1010
PREFIX "/"
1111
FILES
1212
resources/splash.jpg
13+
resources/fonts/Inter-Regular.ttf
14+
resources/fonts/OpenDyslexic3-Regular.ttf
1315
resources/icons/icon.png
1416
resources/icons/dice/d4.png
1517
resources/icons/dice/d6.png

app/ui/Main.qml

+13
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ ApplicationWindow {
6565
}
6666
}
6767

68+
Connections {
69+
target: SettingsManager
70+
71+
function onFontChanged() {
72+
loader.reload();
73+
}
74+
}
75+
6876
UpdateDialog {
6977
id: update_dialog
7078
}
@@ -198,5 +206,10 @@ ApplicationWindow {
198206
active: true
199207

200208
onLoaded: splash.close()
209+
210+
function reload() {
211+
active = false;
212+
active = true;
213+
}
201214
}
202215
}
398 KB
Binary file not shown.
Binary file not shown.

app/ui/tools/settings/GeneralPage.qml

+30
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SplitView {
3535
spacing: 10
3636

3737
Label {
38+
id: language_label
3839
text: qsTr("Select Language")
3940
width: Math.max(implicitWidth, language_box.width)
4041
anchors.verticalCenter: parent.verticalCenter
@@ -60,6 +61,35 @@ SplitView {
6061
}
6162
}
6263

64+
Row {
65+
spacing: 10
66+
67+
Label {
68+
text: qsTr("Select Font")
69+
width: language_label.width
70+
anchors.verticalCenter: parent.verticalCenter
71+
}
72+
73+
ComboBox {
74+
id: font_box
75+
76+
property bool loaded: false
77+
78+
model: SettingsManager.availableFonts
79+
80+
onCurrentTextChanged: {
81+
if (loaded) {
82+
SettingsManager.font = currentText;
83+
}
84+
}
85+
86+
Component.onCompleted: {
87+
currentIndex = SettingsManager.availableFonts.indexOf(SettingsManager.font);
88+
loaded = true;
89+
}
90+
}
91+
}
92+
6393
// Show Tool Names
6494
CheckBox {
6595
text: qsTr("Show tool names in menu")

app/ui/tools/settings/InfoPage.qml

+22-9
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ Item {
7272

7373
Label {
7474
id: credits_label
75-
text: qsTr(
76-
"Credits - Open Source projects and other resources used by this application")
75+
text: qsTr("Credits - Open Source projects and other resources used by this application")
7776
font.pointSize: 12
7877
anchors.top: parent.top
7978
anchors.left: parent.left
@@ -119,20 +118,20 @@ Item {
119118
links: [["Skoll", "https://game-icons.net"], ["Delapouite", "https://delapouite.com"], ["Lorc", "https://lorcblog.blogspot.com"], ["Cathelineau", "https://game-icons.net"]]
120119
}
121120

122-
CreditsItem {
123-
title: "QML IconFonts"
124-
description: qsTr("Use icon fonts in QML")
125-
license: [["Font Awesome: SIL OFL 1.1", "https://scripts.sil.org/OFL"], ["Library: GPLv3", "https://www.gnu.org/licenses/gpl-3.0.en.html"]]
126-
links: [[qsTr("qml-icon-fonts"), "https://github.com/PhilInTheGaps/qml-icon-fonts"], ["FontAwesome", "https://fontawesome.com"]]
127-
}
128-
129121
CreditsItem {
130122
title: "http-status-codes-cpp"
131123
description: qsTr("HTTP Status Codes and Reason Phrases for C, C++ and Qt")
132124
license: [["CC0 1.0 Universal", "https://github.com/j-ulrich/http-status-codes-cpp/blob/main/LICENSE"]]
133125
links: [["j-ulrich/http-status-codes-cpp", "https://github.com/j-ulrich/http-status-codes-cpp"]]
134126
}
135127

128+
CreditsItem {
129+
title: "Inter"
130+
description: qsTr("The Inter font family")
131+
license: [["SIL OFL 1.1", "https://github.com/rsms/inter/blob/master/LICENSE.txt"]]
132+
links: [["Website", "https://rsms.me/inter/"], ["GitHub", "https://github.com/rsms/inter"]]
133+
}
134+
136135
CreditsItem {
137136
title: "Librespot"
138137
description: qsTr("Open Source Spotify client library")
@@ -154,6 +153,20 @@ Item {
154153
links: [["GitHub", "https://github.com/pipacs/o2"], ["pipacs", "https://github.com/pipacs"]]
155154
}
156155

156+
CreditsItem {
157+
title: "OpenDyslexic"
158+
description: qsTr("A typeface for Dyslexia")
159+
license: [["SIL OFL 1.1", "https://github.com/antijingoist/opendyslexic/blob/master/OFL.txt"]]
160+
links: [["Website", "https://opendyslexic.org/"], ["GitHub", "https://github.com/antijingoist/opendyslexic"]]
161+
}
162+
163+
CreditsItem {
164+
title: "QML IconFonts"
165+
description: qsTr("Use icon fonts in QML")
166+
license: [["Font Awesome: SIL OFL 1.1", "https://scripts.sil.org/OFL"], ["Library: GPLv3", "https://www.gnu.org/licenses/gpl-3.0.en.html"]]
167+
links: [[qsTr("qml-icon-fonts"), "https://github.com/PhilInTheGaps/qml-icon-fonts"], ["FontAwesome", "https://fontawesome.com"]]
168+
}
169+
157170
CreditsItem {
158171
title: "Qt Project"
159172
description: qsTr("A C++ toolkit for cross-platform application development.")

src/common/settings/quick/settingsmanager.h

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class SettingsManager : public QObject
3333
SETTINGS_PROPERTY(QString, cloudMode, QStringLiteral("local"))
3434
READ_PROPERTY2(QString, languageBcp47, Common::Settings::SettingsManager::instance()->getLanguageBcp47())
3535

36+
SETTINGS_PROPERTY(QString, font, QStringLiteral("Inter"))
37+
READONLY_PROPERTY2(QStringList, availableFonts, QStringList({"Inter", "OpenDyslexic3"}))
38+
3639
#ifdef NO_UPDATE_CHECK
3740
SETTINGS_PROPERTY_VAL2(bool, checkForUpdates, false, "Updates")
3841
#else

0 commit comments

Comments
 (0)