[osg-users] Unicode text with osg
Hello OSG users, Is it possible to use international text (probably unicode) with osgText? I just get garbled characters when I use my application which uses osgText for the text. When using vi or other text editors I can see the international characters normally. I am using OSG 2.8.3 primarily. Linux Fedora 14 running on 2008 15 Mac Book Pro nVidia GeForce 8600M GT nVidia driver 256.53 -Eric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Unicode text with osg
Hi Eric On Thu, May 26, 2011 at 7:07 AM, Eric Sokolowsky esok@gmail.com wrote: Is it possible to use international text (probably unicode) with osgText? I just get garbled characters when I use my application which uses osgText for the text. When using vi or other text editors I can see the international characters normally. I am using OSG 2.8.3 primarily. Are you specifying the correct encoding type when setting the string on the osgText object? I am able to display Unicode characters fine on Windows using UTF-8 encoding. I haven't tried other encodings though. I'm not sure if this is an issue on Mac, but on Windows some characters don't show up properly, even when the correct encoding is specified. This is because the selected font might not support all the Unicode characters in the string. So you might wan to make sure that the font you are using supports all the characters you are trying to display. Cheers, Farshid ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Unicode text with osg
Hi, Eric I used osgText with both wstrings and normal std::strings (with utf8) in both linux and windows. You may need to set right locale with std::setlocale to use strings with utf8 text. On windows with msvs you can have troubles with text in code like std::string s = smth, it depends on editor text encoding settings. Make sure that you use font which have characters you need. Cheers, Sergey. 26.05.2011, 18:07, Eric Sokolowsky esok@gmail.com: Hello OSG users, Is it possible to use international text (probably unicode) with osgText? I just get garbled characters when I use my application which uses osgText for the text. When using vi or other text editors I can see the international characters normally. I am using OSG 2.8.3 primarily. Linux Fedora 14 running on 2008 15 Mac Book Pro nVidia GeForce 8600M GT nVidia driver 256.53 -Eric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Unicode text with osg
Farshid Lashkari wrote: Hi Eric On Thu, May 26, 2011 at 7:07 AM, Eric Sokolowsky esok@gmail.com mailto:esok@gmail.com wrote: Is it possible to use international text (probably unicode) with osgText? I just get garbled characters when I use my application which uses osgText for the text. When using vi or other text editors I can see the international characters normally. I am using OSG 2.8.3 primarily. Are you specifying the correct encoding type when setting the string on the osgText object? I am able to display Unicode characters fine on Windows using UTF-8 encoding. I haven't tried other encodings though. Farshid, Thank you! This was the problem. I was using the regular setText() with one argument, and not the proper setText() with two arguments, the second being the encoding. I have changed my code and it now works as expected. Eric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org