From 6d3f9ce3072cf789165a5f28b073129937f47815 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 26 Apr 2020 22:20:57 +0200 Subject: [PATCH 1/2] puts an end of error spam when OSG is copmiled without Freetype support --- components/resource/stats.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index 51497cd27..1d78d7a4c 100644 --- a/components/resource/stats.cpp +++ b/components/resource/stats.cpp @@ -8,6 +8,8 @@ #include +#include + #include #include @@ -32,12 +34,14 @@ StatsHandler::StatsHandler(): _resourceStatsChildNum = 0; - _font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf"); + if (osgDB::Registry::instance()->getReaderWriterForExtension("ttf")) + _font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf"); } Profiler::Profiler() { - _font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf"); + if (osgDB::Registry::instance()->getReaderWriterForExtension("ttf")) + _font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf"); setKeyEventTogglesOnScreenStats(osgGA::GUIEventAdapter::KEY_F3); } From 1870b4b34586a052ee70b41a771d89c174558c31 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Mon, 27 Apr 2020 08:02:42 +0200 Subject: [PATCH 2/2] catch and set with no _found; leave empty as empty string --- components/resource/stats.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index 1d78d7a4c..bc63ddf58 100644 --- a/components/resource/stats.cpp +++ b/components/resource/stats.cpp @@ -42,6 +42,8 @@ Profiler::Profiler() { if (osgDB::Registry::instance()->getReaderWriterForExtension("ttf")) _font = osgMyGUI::DataManager::getInstance().getDataPath("DejaVuLGCSansMono.ttf"); + else + _font = ""; setKeyEventTogglesOnScreenStats(osgGA::GUIEventAdapter::KEY_F3); }