From 55a45e3c0e2634925a06f1e54877c808e8fc5786 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 6 Feb 2018 17:54:33 +0000 Subject: [PATCH] Changed the text bounding box calcualtion so that it only takes in to account the basic glyph size, and doesn't add in the glyph margin used for accounting for texel sampling --- src/osgText/Text.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index e271e3460..4069a6318 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -674,17 +674,17 @@ void Text::computeGlyphRepresentation() { case LEFT_TO_RIGHT: cursor.x() += glyph->getHorizontalAdvance() * wr; - _textBB.expandBy(osg::Vec3(minc.x(), minc.y(), 0.0f)); //lower left corner - _textBB.expandBy(osg::Vec3(maxc.x(), maxc.y(), 0.0f)); //upper right corner + _textBB.expandBy(osg::Vec3(local.x(), local.y(), 0.0f)); //lower left corner + _textBB.expandBy(osg::Vec3(local.x()+width, local.y()+height, 0.0f)); //upper right corner break; case VERTICAL: cursor.y() -= glyph->getVerticalAdvance() * hr; - _textBB.expandBy(osg::Vec3(minc.x(),maxc.y(),0.0f)); //upper left corner - _textBB.expandBy(osg::Vec3(maxc.x(),minc.y(),0.0f)); //lower right corner + _textBB.expandBy(osg::Vec3(local.x(), local.y()+height, 0.0f)); //upper left corner + _textBB.expandBy(osg::Vec3(local.x()+width, local.y(), 0.0f)); //lower right corner break; case RIGHT_TO_LEFT: - _textBB.expandBy(osg::Vec3(maxc.x(),minc.y(),0.0f)); //lower right corner - _textBB.expandBy(osg::Vec3(minc.x(),maxc.y(),0.0f)); //upper left corner + _textBB.expandBy(osg::Vec3(local.x()+width, local.y(), 0.0f)); //lower right corner + _textBB.expandBy(osg::Vec3(local.x(), local.y()+height, 0.0f)); //upper left corner break; } }