From fa8b8c6a52be61b7f269c79503ea933428eb4efe Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 10 Jul 2003 13:18:13 +0000 Subject: [PATCH] From Tree, fixes for text bounding box initialization. --- src/osgText/Text.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 9812dea84..f95b41b98 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -262,7 +262,12 @@ void Text::computeGlyphRepresentation() _textureGlyphQuadMap.clear(); - if (_text.empty()) return; + if (_text.empty()) + { + _textBB.set(0,0,0,0,0,0);//no size text + computePositions(); //to reset the origin + return; + } osg::Vec2 startOfLine(0.0f,0.0f); osg::Vec2 cursor(startOfLine); @@ -299,7 +304,11 @@ void Text::computeGlyphRepresentation() float width = (float)(glyph->s()-2*activefont->getGlyphImageMargin()) * wr; float height = (float)(glyph->t()-2*activefont->getGlyphImageMargin()) * hr; - + //#define TREES_CODE_FOR_MAKING_SPACES_EDITABLE + #ifdef TREES_CODE_FOR_MAKING_SPACES_EDITABLE + if (width == 0.0f) width = glyph->getHorizontalAdvance() * wr; + if (height == 0.0f) height = glyph->getVerticalAdvance() * hr; + #endif if (_layout==RIGHT_TO_LEFT) { cursor.x() -= glyph->getHorizontalAdvance() * wr;