diff --git a/scwx-qt/res/fonts/din1451alt_g.ttf b/scwx-qt/res/fonts/din1451alt_g.ttf new file mode 100644 index 00000000..148fefd4 Binary files /dev/null and b/scwx-qt/res/fonts/din1451alt_g.ttf differ diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake index 5bb594d3..53701c11 100644 --- a/scwx-qt/scwx-qt.cmake +++ b/scwx-qt/scwx-qt.cmake @@ -57,8 +57,10 @@ set(HDR_GL source/scwx/qt/gl/gl.hpp source/scwx/qt/gl/text_shader.hpp) set(SRC_GL source/scwx/qt/gl/shader_program.cpp source/scwx/qt/gl/text_shader.cpp) -set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp) -set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp) +set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp + source/scwx/qt/manager/resource_manager.hpp) +set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp + source/scwx/qt/manager/resource_manager.cpp) set(HDR_MAP source/scwx/qt/map/map_widget.hpp source/scwx/qt/map/overlay_layer.hpp source/scwx/qt/map/radar_layer.hpp diff --git a/scwx-qt/scwx-qt.qrc b/scwx-qt/scwx-qt.qrc index a2e2bec9..02d40dc5 100644 --- a/scwx-qt/scwx-qt.qrc +++ b/scwx-qt/scwx-qt.qrc @@ -7,5 +7,6 @@ gl/text.frag gl/text.vert res/fonts/din1451alt.ttf + res/fonts/din1451alt_g.ttf diff --git a/scwx-qt/source/scwx/qt/main/main.cpp b/scwx-qt/source/scwx/qt/main/main.cpp index a48fbd4c..f4038493 100644 --- a/scwx-qt/source/scwx/qt/main/main.cpp +++ b/scwx-qt/source/scwx/qt/main/main.cpp @@ -1,4 +1,5 @@ -#include "main_window.hpp" +#include +#include #include #include @@ -9,6 +10,8 @@ int main(int argc, char* argv[]) boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); + scwx::qt::manager::ResourceManager::PreLoad(); + QApplication a(argc, argv); scwx::qt::main::MainWindow w; w.show(); diff --git a/scwx-qt/source/scwx/qt/manager/resource_manager.cpp b/scwx-qt/source/scwx/qt/manager/resource_manager.cpp new file mode 100644 index 00000000..12d041d9 --- /dev/null +++ b/scwx-qt/source/scwx/qt/manager/resource_manager.cpp @@ -0,0 +1,28 @@ +#include +#include + +namespace scwx +{ +namespace qt +{ +namespace manager +{ +namespace ResourceManager +{ +static void LoadFonts(); + +void PreLoad() +{ + LoadFonts(); +} + +static void LoadFonts() +{ + util::Font::Create(":/res/fonts/din1451alt.ttf"); + util::Font::Create(":/res/fonts/din1451alt_g.ttf"); +} + +} // namespace ResourceManager +} // namespace manager +} // namespace qt +} // namespace scwx diff --git a/scwx-qt/source/scwx/qt/manager/resource_manager.hpp b/scwx-qt/source/scwx/qt/manager/resource_manager.hpp new file mode 100644 index 00000000..ee30bb8f --- /dev/null +++ b/scwx-qt/source/scwx/qt/manager/resource_manager.hpp @@ -0,0 +1,15 @@ +#pragma once + +namespace scwx +{ +namespace qt +{ +namespace manager +{ +namespace ResourceManager +{ +void PreLoad(); +} // namespace ResourceManager +} // namespace manager +} // namespace qt +} // namespace scwx diff --git a/scwx-qt/source/scwx/qt/util/font.cpp b/scwx-qt/source/scwx/qt/util/font.cpp index 08134697..b29506bd 100644 --- a/scwx-qt/source/scwx/qt/util/font.cpp +++ b/scwx-qt/source/scwx/qt/util/font.cpp @@ -250,6 +250,7 @@ std::shared_ptr Font::Create(const std::string& resource) auto it = fontMap_.find(resource); if (it != fontMap_.end()) { + BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Font already created"; return it->second; }