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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user