Did you tried

osgText::String textstr;
textstr.set(L"азимут",osgText::String::ENCODING_UTF8);
text->setText(str);
?
Character between " " are interpetred as 1 byte char if you don't use some macro or the long byte specification.

Roman Grigoriev ha scritto:
Thanx Robert!
Problem solved by using wchar

wchar_t str[]=L"Привет мир!!!";
text->setText(str);

All works. Thanx again

P.S.but this statement doesn't work
osgText::String textstr;
textstr.set("азимут",osgText::String::ENCODING_UTF8);
text->setText(str);
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Thursday, October 23, 2008 4:57 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Localization problem

Hi Roman,

Have you actually looked at the available options in
osg::Text::String?  Go have a look at the header and you'll see:

        /**
         * Types of string encodings supported
         */
        enum Encoding
        {
            ENCODING_UNDEFINED,                 /// not using Unicode
            ENCODING_ASCII = ENCODING_UNDEFINED,/// unsigned char ASCII
            ENCODING_UTF8,                      /// 8-bit unicode
transformation format
            ENCODING_UTF16,                     /// 16-bit signature
            ENCODING_UTF16_BE,                  /// 16-bit big-endian
            ENCODING_UTF16_LE,                  /// 16-bit little-endian
            ENCODING_UTF32,                     /// 32-bit signature
            ENCODING_UTF32_BE,                  /// 32-bit big-endian
            ENCODING_UTF32_LE,                  /// 32-bit little-endian
            ENCODING_SIGNATURE                  /// detect encoding
from signature
        };


        String() {}
        String(const String& str);
        String(const std::string& str) { set(str); }
        String(const wchar_t* text) { set(text); }
        String(const std::string& text,Encoding encoding) {
set(text,encoding); }

        String& operator = (const String& str);

        void set(const std::string& str);

        /** Set the text using a wchar_t string,
          * which is converted to an internal TextString.*/
        void set(const wchar_t* text);

        /** Set the text using a Unicode encoded std::string, which is
converted to an internal TextString.
          * The encoding parameter specifies which Unicode encoding is
used in the std::string. */
        void set(const std::string& text,Encoding encoding);

Your own example of usage below will be using the standard
String::set(std::string)  which doesn't have any encoding beyond
standard ascii.  Instead you'll want to use wchar* or specify the
encoding.

Robert.

On Thu, Oct 23, 2008 at 1:37 PM, Roman Grigoriev <[EMAIL PROTECTED]>
wrote:
I tried this way but it doest work

osgText::String textstr;
textstr.set("азимут");
text->setText(textstr);
Thanx in advance
Bye
Roman

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roman
Grigoriev
Sent: Thursday, October 23, 2008 4:06 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] Localization problem

Hi Robert!
Could you please give me example how to use your method
Thanx in advance
Bye


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Thursday, October 23, 2008 3:51 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Localization problem

HI Roman,

The osgText library has an osgText::String class for handling full
range of sybmol types so you use this to set the Text's value rather
than the std::string based setText(..) method you are using right now.

Robert.

2008/10/23 Roman Grigoriev <[EMAIL PROTECTED]>:
Hi guys!

I try to translate my osg text to my local language have wrong symbols

I've done it using this way.

Please help me if someone did it.

Thanx in advance

Bye



 std::string timesFont("arial.ttf");



        osg::StateSet* stateset = geode->getOrCreateStateSet();

        stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);



        osg::Vec3 position(20.0f,300.0f,0.0f);

        osg::Vec3 delta(0.0f,-20.0f,0.0f);



        {

            osgText::Text* text = new  osgText::Text;

            geode->addDrawable( text );



            text->setFont(timesFont);

            text->setPosition(position);

            text->setText("Азимут");



            position += delta;

        }

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to