From Eric Sokolwsky, "osgText is a useful node kit, but when longer paragraphs are displayed

on the screen, it looks more aesthetically pleasing to have a larger
gap between lines than is given by default. I added a new parameter,
lineSpacing, in the Text class to allow the line spacing to be adjustable
by the application. The default value is 0 meaning there is no extra
spacing given. The value should be given as a percentage of the character
height. A good value for longer paragraphs is 0.25 (25%) or more."
This commit is contained in:
Robert Osfield
2007-01-30 14:32:12 +00:00
parent 35c720420e
commit 77b9a7ae19
2 changed files with 22 additions and 4 deletions

View File

@@ -119,12 +119,21 @@ public:
/** Set the maximum height of the text box.
* With horizontal layouts any characters which do not fit are wrapped around.
* 0 or negative values indicate that no maximum height is set, lines can be as long as
* they need be to fit thre required text*/
* they need be to fit the required text*/
void setMaximumHeight(float maximumHeight);
/** Get the maximum height of the text box.*/
float getMaximumHeight() const { return _maximumHeight; }
/** Set the line spacing of the text box, given as a percentage of
* the character height. The default value is 0 for backward
* compatibility. For longer paragraphs of text, a value of at
* least 25% (i.e. set line spacing to 0.25) is recommended. */
void setLineSpacing(float lineSpacing);
/** Get the line spacing of the text box. */
float getLineSpacing() const { return _lineSpacing; }
/** Set the position of text.*/
@@ -522,6 +531,7 @@ protected:
CharacterSizeMode _characterSizeMode;
float _maximumWidth;
float _maximumHeight;
float _lineSpacing;
String _text;
osg::Vec3 _position;