From d96951659569e02adbd3dbbbebbe860203e26755 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 13 Jan 2020 09:58:47 +0000 Subject: [PATCH] Added encoding and font setting to dxfText as a first step towards making these user controllable to enble handling of non default settings --- src/osgPlugins/dxf/dxfEntity.cpp | 4 ++-- src/osgPlugins/dxf/dxfEntity.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/dxf/dxfEntity.cpp b/src/osgPlugins/dxf/dxfEntity.cpp index edb27034e..062974ac6 100644 --- a/src/osgPlugins/dxf/dxfEntity.cpp +++ b/src/osgPlugins/dxf/dxfEntity.cpp @@ -910,10 +910,10 @@ dxfText::drawScene(scene* sc) sc->ocs(m); ref_ptr _text = new osgText::Text; - _text->setText(_string); + _text->setText(_string, encoding); + _text->setFont(font); _text->setCharacterSize( _height, 1.0/_xscale ); - _text->setFont("arial.ttf"); Quat qr( DegreesToRadians(_rotation), Z_AXIS ); diff --git a/src/osgPlugins/dxf/dxfEntity.h b/src/osgPlugins/dxf/dxfEntity.h index 071f42b45..ee553cb3d 100644 --- a/src/osgPlugins/dxf/dxfEntity.h +++ b/src/osgPlugins/dxf/dxfEntity.h @@ -293,6 +293,8 @@ class dxfText : public dxfBasicEntity { public: dxfText() : + encoding(osgText::String::ENCODING_ASCII), + font("arial.ttf"), _string(""), _point1(0,0,0), _point2(0,0,0), @@ -310,6 +312,10 @@ public: virtual void assign(dxfFile* dxf, codeValue& cv); virtual void drawScene(scene* sc); + // application settings + osgText::String::Encoding encoding; + std::string font; + protected: std::string _string; // 1 osg::Vec3d _point1; // 10,20,30