Skip to content

Commit

Permalink
Added inter as the default font and open dyslexic as an alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilInTheGaps committed Dec 11, 2023
1 parent 9c1fa8f commit 56c5690
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 12 deletions.
8 changes: 5 additions & 3 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ auto main(int argc, char *argv[]) -> int
QGuiApplication::setWindowIcon(QIcon(u":/resources/icons/icon.png"_s));
setPalette();

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

const Logger logger;

Expand Down
2 changes: 2 additions & 0 deletions app/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ qt_add_resources(gm-companion-ui "ui-resources"
PREFIX "/"
FILES
resources/splash.jpg
resources/fonts/Inter-Regular.ttf
resources/fonts/OpenDyslexic3-Regular.ttf
resources/icons/icon.png
resources/icons/dice/d4.png
resources/icons/dice/d6.png
Expand Down
13 changes: 13 additions & 0 deletions app/ui/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ ApplicationWindow {
}
}

Connections {
target: SettingsManager

function onFontChanged() {
loader.reload();
}
}

UpdateDialog {
id: update_dialog
}
Expand Down Expand Up @@ -198,5 +206,10 @@ ApplicationWindow {
active: true

onLoaded: splash.close()

function reload() {
active = false;
active = true;
}
}
}
Binary file added app/ui/resources/fonts/Inter-Regular.ttf
Binary file not shown.
Binary file added app/ui/resources/fonts/OpenDyslexic3-Regular.ttf
Binary file not shown.
30 changes: 30 additions & 0 deletions app/ui/tools/settings/GeneralPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SplitView {
spacing: 10

Label {
id: language_label
text: qsTr("Select Language")
width: Math.max(implicitWidth, language_box.width)
anchors.verticalCenter: parent.verticalCenter
Expand All @@ -60,6 +61,35 @@ SplitView {
}
}

Row {
spacing: 10

Label {
text: qsTr("Select Font")
width: language_label.width
anchors.verticalCenter: parent.verticalCenter
}

ComboBox {
id: font_box

property bool loaded: false

model: SettingsManager.availableFonts

onCurrentTextChanged: {
if (loaded) {
SettingsManager.font = currentText;
}
}

Component.onCompleted: {
currentIndex = SettingsManager.availableFonts.indexOf(SettingsManager.font);
loaded = true;
}
}
}

// Show Tool Names
CheckBox {
text: qsTr("Show tool names in menu")
Expand Down
31 changes: 22 additions & 9 deletions app/ui/tools/settings/InfoPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ Item {

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

CreditsItem {
title: "QML IconFonts"
description: qsTr("Use icon fonts in QML")
license: [["Font Awesome: SIL OFL 1.1", "https://scripts.sil.org/OFL"], ["Library: GPLv3", "https://www.gnu.org/licenses/gpl-3.0.en.html"]]
links: [[qsTr("qml-icon-fonts"), "https://github.com/PhilInTheGaps/qml-icon-fonts"], ["FontAwesome", "https://fontawesome.com"]]
}

CreditsItem {
title: "http-status-codes-cpp"
description: qsTr("HTTP Status Codes and Reason Phrases for C, C++ and Qt")
license: [["CC0 1.0 Universal", "https://github.com/j-ulrich/http-status-codes-cpp/blob/main/LICENSE"]]
links: [["j-ulrich/http-status-codes-cpp", "https://github.com/j-ulrich/http-status-codes-cpp"]]
}

CreditsItem {
title: "Inter"
description: qsTr("The Inter font family")
license: [["SIL OFL 1.1", "https://github.com/rsms/inter/blob/master/LICENSE.txt"]]
links: [["Website", "https://rsms.me/inter/"], ["GitHub", "https://github.com/rsms/inter"]]
}

CreditsItem {
title: "Librespot"
description: qsTr("Open Source Spotify client library")
Expand All @@ -154,6 +153,20 @@ Item {
links: [["GitHub", "https://github.com/pipacs/o2"], ["pipacs", "https://github.com/pipacs"]]
}

CreditsItem {
title: "OpenDyslexic"
description: qsTr("A typeface for Dyslexia")
license: [["SIL OFL 1.1", "https://github.com/antijingoist/opendyslexic/blob/master/OFL.txt"]]
links: [["Website", "https://opendyslexic.org/"], ["GitHub", "https://github.com/antijingoist/opendyslexic"]]
}

CreditsItem {
title: "QML IconFonts"
description: qsTr("Use icon fonts in QML")
license: [["Font Awesome: SIL OFL 1.1", "https://scripts.sil.org/OFL"], ["Library: GPLv3", "https://www.gnu.org/licenses/gpl-3.0.en.html"]]
links: [[qsTr("qml-icon-fonts"), "https://github.com/PhilInTheGaps/qml-icon-fonts"], ["FontAwesome", "https://fontawesome.com"]]
}

CreditsItem {
title: "Qt Project"
description: qsTr("A C++ toolkit for cross-platform application development.")
Expand Down
3 changes: 3 additions & 0 deletions src/common/settings/quick/settingsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class SettingsManager : public QObject
SETTINGS_PROPERTY(QString, cloudMode, QStringLiteral("local"))
READ_PROPERTY2(QString, languageBcp47, Common::Settings::SettingsManager::instance()->getLanguageBcp47())

SETTINGS_PROPERTY(QString, font, QStringLiteral("Inter"))
READONLY_PROPERTY2(QStringList, availableFonts, QStringList({"Inter", "OpenDyslexic3"}))

#ifdef NO_UPDATE_CHECK
SETTINGS_PROPERTY_VAL2(bool, checkForUpdates, false, "Updates")
#else
Expand Down

0 comments on commit 56c5690

Please sign in to comment.