[osg-users] osgText::readFontFile returns NULL on valid argument

Guy guy at dvp.co.il
Wed Mar 18 23:01:54 PDT 2009

Hi jesper,

 You could in the start of your program call
osgDB::Registry::instance()->getLibraryPathList().push_front(<your dlls
path>). In that case it doesn't depend on environment settings.







Thank you for your answers.


I have actually found out that the problem is that my program can't find
the osgdb_freetype.dll plugin, even though it is in the osgPlugins-2.6.1
directory in the private assembly I have created for OSG distribution.
I'm currently messing about a bit with the manifests to try and get it
to find it. Apparently it doesn't use it if I just add it to the
manifest along with the osg48-osg.dll and other dll's, but if I place it
in the same directory as my application it works just fine.

I don't want to have to add OSG to the path of the computer as I want to
preserve backwards compatability when my program gets ported to a newer
OSG version.
BTW: have anybody tried creating an OSG shared assembly?


Jesper D. Thomsen


From: osg-users-bounces at lists.openscenegraph.org
[osg-users-bounces at lists.openscenegraph.org] On Behalf Of Cole, Charles
[charles.e.cole at nasa.gov]
Sent: Wednesday, March 18, 2009 1:54 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgText::readFontFile returns NULL on valid

Hi Jesper,


My first inclination is that the path is incorrect, or at least doesn't
match with where the font file actually is.  With the code snippet you
listed, I believe that the file (and path) that you list must be
relative to your project's compiled executable.  That would be the first
thing that I'd check, and Paul's tip on adding the OSG_NOTIFY_LEVEL can
help if you can run your executable from a DOS window.  Another means of
checking is to place the font file in the same directory as your
executable and change the readFontFile parameter to just "arial.ttf".
If that works, then that confirms that it's a path issue.


Hope that helps.




From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Jesper
D. Thomsen
Sent: Wednesday, March 18, 2009 7:57 AM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] osgText::readFontFile returns NULL on valid


Hi all, I have a rather strange problem.

I'm using osgText in my project, but I'm getting null as return from
this method:


osgText::Font* t_font = osgText::readFontFile("fonts/arial.ttf");


The strange part is that when I compile and run the osgText and osgHud
examples, it works just fine (so it isn't the font-file which is
missing). It only happens in my own program. 
So far I have tested it on both Vista and XP machines in the office, and
this doesn't seem to affect the problem. However, my program works just
fine on a single XP machine, but not on any of the other machines. I
have tried in both debug and release modes, and tried both copying the
executable and building it on different machines, and so far it is
consistent in that the deciding factor is which machining is running the
program and not which machine it was built on.


I'm using OSG 2.6.1 in Visual Studio 2005 sp1 on a Vista machine (but
have tested on XP also).


Since the osg examples work just fine on the same machine, I guess it is
something I have done in either the project settings or somewhere in the
code, but I'm running out of ideas. If anybody have tried something like
this, or knows what could cause this, I would very much appreciate it.


regards, and thanks in advance.


Jesper D. Thomsen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090319/afd7a0f2/attachment-0003.htm>

More information about the osg-users mailing list