osgEarth2.5中文支持 如何解决
重载了源码AnnotationUtils.cpp中
osg::Drawable*
AnnotationUtils::createTextDrawable(const std::wstring& text,
const TextSymbol*symbol,
const osg::Vec3& positionOffset )
然后又重载了PlaceNode.cpp中
PlaceNode::PlaceNode(MapNode* mapNode,
const GeoPoint& position,
osg::Image* image,
const std::wstring& text,
const Style& style ) :
OrthoNode( mapNode, position ),
_image ( image ),
_wtext ( text ),
_style ( style ),
_geode ( 0L )
{
initw();
}
在加载中文地标的时候,出现的还是乱码,如何解决
osgEarth::Annotation::PlaceNode *pn = new osgEarth::Annotation::PlaceNode(mapNode, mappnt,tempImg,"中国",/*strName.GetBuffer(0),*/ style); 其实完全不需要这么麻烦。
字体设置为中文字体(譬如:simhei.ttf);并且设置字符编码为:ENCODING_UTF8;传入的字体只需要utf8即可
(如:osgDB::convertStringFromCurrentCodePageToUTF8("中文字体"))
楼上的方法完全正确。
不建议修改源码 cug_osg 发表于 2014-7-25 22:57
其实完全不需要这么麻烦。
字体设置为中文字体(譬如:simhei.ttf);并且设置字符编码为:ENCODING_UTF8; ...
能说的详细些吗?在线等,急求,
我的问题是:
中文无法显示
如想 显示“aa啊啊bb”,最终的结果是“aabb” cug_osg 发表于 2014-7-25 22:57
其实完全不需要这么麻烦。
字体设置为中文字体(譬如:simhei.ttf);并且设置字符编码为:ENCODING_UTF8; ...
遇到同样的问题,可以提供一个示例程序吗?
页:
[1]