From a30a4132b8b4e233832393a5764e967069e93167 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 24 Oct 2001 12:53:27 +0000 Subject: [PATCH] Updates to osgText and osgDB so that the loading of text fonts can use osgDB::findFile() to locate font files from the OSGFILEPATH environmental variable. --- src/osgDB/FileUtils.cpp | 6 ++++++ src/osgText/Makefile | 2 +- src/osgText/Text.cpp | 25 ++++++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/osgDB/FileUtils.cpp b/src/osgDB/FileUtils.cpp index eaff1545c..e7a413102 100644 --- a/src/osgDB/FileUtils.cpp +++ b/src/osgDB/FileUtils.cpp @@ -63,6 +63,7 @@ static const char *s_default_dso_path = "/usr/lib/osgPlugins/"; static char *s_filePath = ".:"; #endif +static bool s_filePathInitialized = false; void osgDB::initFilePath( void ) { @@ -76,6 +77,7 @@ void osgDB::initFilePath( void ) { notify(DEBUG_INFO) << "osgDB::Init(NULL)"< +#include + #include "FTFace.h" #include "FTGLBitmapFont.h" #include "FTGLPixmapFont.h" @@ -63,16 +65,21 @@ bool Font:: open(const std::string& font) { clear(); + + char* filename = osgDB::findFile(font.c_str()); + if (filename) + { - _font=createFontObj(); - if( _font!=NULL && _font->Open(font.c_str()) ) - { - _init=true; - _fontName=font; - return true; - } - else - return false; + _font=createFontObj(); + if( _font!=NULL && _font->Open(filename) ) + { + _init=true; + _fontName=font; + return true; + } + else + return false; + } } bool Font::