diff --git a/src/osgText/TextBase.cpp b/src/osgText/TextBase.cpp index a45e25b7b..3acb80c16 100644 --- a/src/osgText/TextBase.cpp +++ b/src/osgText/TextBase.cpp @@ -484,6 +484,14 @@ void TextBase::computePositions() void TextBase::computePositionsImplementation() { + _normal = osg::Vec3(0.0f,0.0f,1.0f); + + if (_text.empty()) + { + _offset = Vec3(); + return; + } + switch(_alignment) { case LEFT_TOP: _offset.set(_textBB.xMin(),_textBB.yMax(),_textBB.zMin()); break; @@ -506,8 +514,6 @@ void TextBase::computePositionsImplementation() case CENTER_BOTTOM_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; case RIGHT_BOTTOM_BASE_LINE: _offset.set(_textBB.xMax(),-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; } - - _normal = osg::Vec3(0.0f,0.0f,1.0f); } bool TextBase::computeMatrix(osg::Matrix& matrix, osg::State* state) const