diff --git a/.appveyor.yml b/.appveyor.yml index f2ef0bd..e52de01 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,7 +17,7 @@ before_build: - git submodule update --init --recursive build_script: - - qmake spectral.pro CONFIG+=release CONFIG+=qtquickcompiler PREFIX="%DEPLOY_DIR%" + - qmake spectral.pro CONFIG+=release CONFIG+=qtquickcompiler BUNDLE_FONT=true PREFIX="%DEPLOY_DIR%" - nmake after_build: @@ -27,4 +27,4 @@ after_build: artifacts: - path: spectral.zip - name: portable \ No newline at end of file + name: portable diff --git a/assets/font/roboto.ttf b/assets/font/roboto.ttf new file mode 100644 index 0000000..2c97eea Binary files /dev/null and b/assets/font/roboto.ttf differ diff --git a/assets/font/twemoji.ttf b/assets/font/twemoji.ttf new file mode 100644 index 0000000..b8a19d0 Binary files /dev/null and b/assets/font/twemoji.ttf differ diff --git a/font.qrc b/font.qrc new file mode 100644 index 0000000..cfda4ec --- /dev/null +++ b/font.qrc @@ -0,0 +1,6 @@ + + + assets/font/roboto.ttf + assets/font/twemoji.ttf + + diff --git a/spectral.pro b/spectral.pro index 8c86282..c27eda3 100644 --- a/spectral.pro +++ b/spectral.pro @@ -20,6 +20,9 @@ isEmpty(USE_SYSTEM_SORTFILTERPROXYMODEL) { isEmpty(USE_SYSTEM_QMATRIXCLIENT) { USE_SYSTEM_QMATRIXCLIENT = false } +isEmpty(BUNDLE_FONT) { + BUNDLE_FONT = false +} $$USE_SYSTEM_QMATRIXCLIENT { PKGCONFIG += QMatrixClient @@ -45,8 +48,14 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -RESOURCES += \ - res.qrc +RESOURCES += res.qrc +$$BUNDLE_FONT { + message("Bundling fonts.") + DEFINES += BUNDLE_FONT + RESOURCES += font.qrc +} else { + message("Using fonts from operating system.") +} # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH += imports/ diff --git a/src/main.cpp b/src/main.cpp index fff5044..126de59 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -61,6 +62,11 @@ int main(int argc, char *argv[]) { qRegisterMetaType("SpectralRoom*"); qRegisterMetaType("SpectralUser*"); +#if defined(BUNDLE_FONT) + QFontDatabase::addApplicationFont(":/assets/font/roboto.ttf"); + QFontDatabase::addApplicationFont(":/assets/font/twemoji.ttf"); +#endif + QQmlApplicationEngine engine; engine.addImportPath("qrc:/imports");