OsDrawText

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
{{Template:Quicklinks}}
 
{{Template:Quicklinks}}
 +
{|  width="100%" style="border: thin solid black"
 +
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
 +
|- valign="top"
 +
|'''Threat Level''' || <Threat Level goes here>
  
LSL: '''[[string]] osDrawText( [[string]] drawList, [[string]] text )'''<br />
+
|- valign="top"
C#: '''[[string]] osDrawText( [[string]] drawList, [[string]] text )'''
+
|'''Function Syntax''' || <source lang="lsl">
 
+
LSL: string osDrawText( string drawList, string text )
 
+
C#: string osDrawText( string drawList, string text )
Appends a [[Drawing_commands#Text|Text]] drawing command to the string provided in '''drawList''' and returns the result.
+
</source>
 
+
|- valign="top"
The specified text will be drawn with the current pen color, using the currently defined [[Drawing_commands#FontName|font]], [[OsSetFontSize|size]] and [[Drawing_commands#FontProp|properties]] (which default to regular 14-point Arial).
+
|'''Example(s)||<source lang="lsl">
 
+
The text will be drawn with the upper left corner of the first glyph at the pen's current position (however, note that glyphs within the font may be defined to extend to the left of their origin point).
+
 
+
If you need to include a semicolon in the text to be displayed, you will need to directly manipulate the draw list string using the [[Drawing_commands|drawing commands]] rather than the dynamic texture convenience functions, then specify an alternate data delimiter in the <tt>extraParams</tt> parameter to the <tt>osSetDynamicTexture*</tt> functions. The convenience functions (including '''osDrawImage''') are hardcoded to terminate each command with a semicolon.
+
 
+
The text may or may not be antialiased, depending on the system settings of the machine upon which the simulator is running. Furthermore, if the system is configured to use LCD subpixel antialiasing (e.g. ClearType), the text may have colored fringes on the smoothed pixels, which may result in a less than optimum image.
+
 
+
Please note that the pen position is ''not'' updated after this call.
+
 
+
Example:
+
<source lang="lsl">
+
 
// Example of osDrawText
 
// Example of osDrawText
 
default
 
default
Line 34: Line 27:
 
}
 
}
 
</source>
 
</source>
 +
|}
 +
Appends a [[Drawing_commands#Text|Text]] drawing command to the string provided in '''drawList''' and returns the result.
 +
 +
The specified text will be drawn with the current pen color, using the currently defined [[Drawing_commands#FontName|font]], [[OsSetFontSize|size]] and [[Drawing_commands#FontProp|properties]] (which default to regular 14-point Arial).
 +
 +
The text will be drawn with the upper left corner of the first glyph at the pen's current position (however, note that glyphs within the font may be defined to extend to the left of their origin point).
 +
 +
If you need to include a semicolon in the text to be displayed, you will need to directly manipulate the draw list string using the [[Drawing_commands|drawing commands]] rather than the dynamic texture convenience functions, then specify an alternate data delimiter in the <tt>extraParams</tt> parameter to the <tt>osSetDynamicTexture*</tt> functions. The convenience functions (including '''osDrawImage''') are hardcoded to terminate each command with a semicolon.
 +
 +
The text may or may not be antialiased, depending on the system settings of the machine upon which the simulator is running. Furthermore, if the system is configured to use LCD subpixel antialiasing (e.g. ClearType), the text may have colored fringes on the smoothed pixels, which may result in a less than optimum image.
 +
 +
Please note that the pen position is ''not'' updated after this call.
  
 +
[[Category:OSSL Functions]]
 
[[Category:OSSL]]
 
[[Category:OSSL]]
 
[[Category:OSSL functions without threat level]]
 
[[Category:OSSL functions without threat level]]

Revision as of 16:09, 8 June 2011

OsDrawText
Threat Level <Threat Level goes here>
Function Syntax
LSL: string osDrawText( string drawList, string text )
C#: string osDrawText( string drawList, string text )
Example(s)
// Example of osDrawText
default
{
    state_entry()
    {
        string CommandList = ""; // Storage for our drawing commands
 
        CommandList = osMovePen( CommandList, 10, 10 );           // Upper left corner at <10,10>
        CommandList = osDrawText( CommandList, "Hello, World!" ); // Place some text
 
        // Now draw the image
        osSetDynamicTextureData( "", "vector", CommandList, "width:256,height:256", 0 );
    }
}

Appends a Text drawing command to the string provided in drawList and returns the result.

The specified text will be drawn with the current pen color, using the currently defined font, size and properties (which default to regular 14-point Arial).

The text will be drawn with the upper left corner of the first glyph at the pen's current position (however, note that glyphs within the font may be defined to extend to the left of their origin point).

If you need to include a semicolon in the text to be displayed, you will need to directly manipulate the draw list string using the drawing commands rather than the dynamic texture convenience functions, then specify an alternate data delimiter in the extraParams parameter to the osSetDynamicTexture* functions. The convenience functions (including osDrawImage) are hardcoded to terminate each command with a semicolon.

The text may or may not be antialiased, depending on the system settings of the machine upon which the simulator is running. Furthermore, if the system is configured to use LCD subpixel antialiasing (e.g. ClearType), the text may have colored fringes on the smoothed pixels, which may result in a less than optimum image.

Please note that the pen position is not updated after this call.

Personal tools
General
About This Wiki