From 4935efc1a9fdecd201cbe4f1d052035ef31b51cc Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 9 Feb 2012 14:33:13 +0000 Subject: [PATCH] From Filip Arlet,"I ran into problem with osg::Text _BASE_LINE alignment. It didn't account line spacing. Btw. same problem in 3D text Changed _offset from: -_characterHeight*(_lineCount-1) to: -_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1)" --- src/osgText/Text.cpp | 6 +++--- src/osgText/Text3D.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 514cb271e..60eb5c740 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -600,9 +600,9 @@ void Text::computePositions(unsigned int contextID) const case CENTER_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,0.0f,0.0f); break; case RIGHT_BASE_LINE: _offset.set(_textBB.xMax(),0.0f,0.0f); break; - case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(_lineCount-1),0.0f); break; - case CENTER_BOTTOM_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,-_characterHeight*(_lineCount-1),0.0f); break; - case RIGHT_BOTTOM_BASE_LINE: _offset.set(_textBB.xMax(),-_characterHeight*(_lineCount-1),0.0f); break; + case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; + 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; } AutoTransformCache& atc = _autoTransformCache[contextID]; diff --git a/src/osgText/Text3D.cpp b/src/osgText/Text3D.cpp index a4ae86666..04aee6b65 100644 --- a/src/osgText/Text3D.cpp +++ b/src/osgText/Text3D.cpp @@ -448,9 +448,9 @@ void Text3D::computePositions(unsigned int contextID) const case CENTER_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,0.0f,0.0f); break; case RIGHT_BASE_LINE: _offset.set(_textBB.xMax(),0.0f,0.0f); break; - case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(_lineCount-1),0.0f); break; - case CENTER_BOTTOM_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,-_characterHeight*(_lineCount-1),0.0f); break; - case RIGHT_BOTTOM_BASE_LINE: _offset.set(_textBB.xMax(),-_characterHeight*(_lineCount-1),0.0f); break; + case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break; + 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; } AutoTransformCache& atc = _autoTransformCache[contextID];