From Joran Jessurun, added font search fallbck that strips the leading path from the font file and then looks again.

This commit is contained in:
Robert Osfield
2005-09-28 13:39:26 +00:00
parent 05528abf25
commit b5c4605d1c

View File

@@ -21,6 +21,7 @@
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>
#include <osg/GLU>
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 \""<<str<<"\" not found."<<std::endl;
return std::string();
}