OpenLayer Offline Manual

OpenLayer | TextRenderer | FirstLineWidth FirstLineWidth
int FirstLineWidth( | const std::string &text ) const;
Returns the width of the first text line of the given multi-lined text when printed with this TextRenderer. The width is in pixels. You can pass either single or multi-lined text to this function but it'll always return the width of the first text line. Notice that like any other function of TextRenderer this function takes a reference to a string so you have to construct a string variable of the text before passing it to this function. Examples TextRenderer renderer( ... ); String text = "First line\nSecond line\nThird line"; // Get the width of the first line of the text ("First line") // int textWidth = renderer.FirstLineWidth( text ); Other functions of the class TextRenderer
Load | Load the font
Print | Prints the given text to the screen
SetColor | Sets the color of the font
GetColor | Returns the text color of the font
SetItalics | Sets the italics angle of the text
GetItalics | Returns the italics angle of the text
Width | Returns the width of the given text
Height | Returns the height of the given text
FirstLineWidth | Returns the width of the first text line of the given text
FirstLineHeight | Returns the height of the first text line of the given text
IsValid | Checks if the TextRenderer was loaded correctly
Advanced functions
GetFace |
SendToGPU |
UnloadFromGPU |
UseAutoDelete |
Back to the main page of the manual Questions about FirstLineWidth? Click here.