Hi,
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)

Patch:

Code:

Index: src/osgText/Text.cpp
===================================================================
--- src/osgText/Text.cpp        (revision 12834)
+++ src/osgText/Text.cpp        (working copy)
@@ -600,9 +600,9 @@
     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];
Index: src/osgText/Text3D.cpp
===================================================================
--- src/osgText/Text3D.cpp      (revision 12834)
+++ src/osgText/Text3D.cpp      (working copy)
@@ -448,9 +448,9 @@
     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];





Cheers,
Filip

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44730#44730



Attachment: String.cpp
Description: Binary data

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to