From b5c4605d1cfd9262328a33ef43dc51b726f925a0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 28 Sep 2005 13:39:26 +0000 Subject: [PATCH] From Joran Jessurun, added font search fallbck that strips the leading path from the font file and then looks again. --- src/osgText/Font.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index bc7cf3bc3..873cdbed9 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using namespace osgText; @@ -60,6 +61,15 @@ std::string findFontFile(const std::string& str) filename = osgDB::findFileInPath(str,s_FontFilePath); if (!filename.empty()) return filename; + // Try filename without pathname, if it has a path + filename = osgDB::getSimpleFileName(str); + if(filename!=str) + { + filename = osgDB::findFileInPath(filename,s_FontFilePath); + if (!filename.empty()) return filename; + } + + // Not found, return empty string osg::notify(osg::WARN)<<"Warning: font file \""<