Hello Gianni,

I looked at the OSG examples in vain to understand how to load a font properly. OSG examples work fine if started from my 
dev environment (VS) but setFont("fonts/blablabla.ttf") does not work if I run my app "normally" double 
clicking on the .exe file. The "osgtext" example have the same problem and I read "unable to load 
\"fonts/fudd.ttf\" and the same for all fonts.

TrueType fonts are loaded by the FreeType plugin (osgdb_freetype). The DLL for this plugin must be in your osgPlugins-<version> directory like any other plugin (loader), and if it has any depedencies (like a freetype DLL for example) these also must be findable by your app at runtime (in your PATH, or in your app's directory).

If this is all findable, then the problem might be that your path to the font file is not correct. A font file is like an image, you need to give the right path. You might want to distribute your fonts with your app to make sure it can find them (make sure you use fonts you can redistribute in this way - check the license terms for the fonts you use or use open source fonts).

So to sum up, a font file is like any other data file. Your path to load it must be correct, and OSG must have the plugin and its dependencies to be able to load it.

You might be thinking of the system font directory, you could use that by using the WINDIR environment variable and then add \fonts\<fontname.ttf> to the end, but I wouldn't advise you use that since then you're dependent on what fonts the user has installed, and it's not portable to other operating systems. Much better to find an open source font you like and distribute it with your app.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to