How to display utf-8 characters like alpha and beta in OpenSceneGraph or osg

836 views Asked by At

I need to display UTF-8 characters in osg, however text->setText( test,osgText::String::ENCODING_UTF8 ); cannot display though, it's like ? in the scene. Does anybody have the same problem or know how to do it?

Code Snippet

osg::ref_ptr<osg::Geode> geode = new osg::Geode;
{
    osg::ref_ptr<osgText::Text> text = new osgText::Text; 
    text->setFont( "CAMBRIA.TTC" );
    //text->setFont( font.get() );
    text->setColor( white );
    text->setCharacterSize( characterSize );
    text->setPosition( OsgFunc::arrowArcTextPosition( centerPoint, centerPoint + osg::Vec3( -30, 0, 0 ), centerPoint + v ) + osg::Vec3d( 0, -5, 1 ) );
    text->setAxisAlignment( osgText::Text::SCREEN );
    text->setText( "\u03b2",osgText::String::ENCODING_UTF8 );
    geode->addDrawable( text.get() );
}
0

There are 0 answers