[osg-users] setFont

2010-06-29 Thread Gianni Ambrosio
Hi All,
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.

Is there a way in OSG to load fonts without copying the ttf file in the exe dir 
or set the file in the resources?

Regards
Gianni

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=29485#29485





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setFont

2010-06-29 Thread Alberto Luaces
Gianni Ambrosio writes:

 Is there a way in OSG to load fonts without copying the ttf file in the exe 
 dir or set the file in the resources?

Setting the environment variable OSG_FILE_PATH.

-- 
Alberto

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setFont

2010-06-29 Thread Jean-Sébastien Guay

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 Guayjean-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


Re: [osg-users] setFont

2010-06-29 Thread Gianni Ambrosio
OK, so there isn't a special way to handle fonts in OSG.
Thanks, Gianni

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=29491#29491





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org