OsSetFontSize

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Removed 'Template:' prefix from template includings and/or changed external-link into internal-link)
Line 1: Line 1:
 
{{Quicklinks}}
 
{{Quicklinks}}
  
LSL: '''[[string]] osSetFontSize( [[string]] drawList, [[integer]] fontSize )'''<br />
+
{|  width="100%" style="border: thin solid black"
C#: '''[[string]] osSetFontSize( [[string]] drawList, [[int]] fontSize )'''
+
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
 +
|- valign="top"
 +
|'''Threat Level''' || <Threat Level goes here>
  
 
+
|- valign="top"
Appends a [[Drawing_commands#FontSize|FontSize]] drawing command to the string provided in '''drawList''' and returns the result.
+
|'''Function Syntax''' || <source lang="lsl">
 
+
LSL: string osSetFontSize( string drawList, integer fontSize )
Sets the size of the font used by subsequent '''[[OsDrawText | osDrawTextText]]'''() calls. The '''fontSize''' parameter represents the font height in points.
+
C#: string osSetFontSize( string drawList, int fontSize )
 
+
</source>
Please note that the font height is given in ''points'', not in ''pixels''. The resulting size of the font in pixels may vary depending on the system settings, specifically the display system's "dots per inch" metric.  A system set to 96dpi will produce differently sized text than a system set to 120dpi. If precise text size is required, consider using the [[osGetDrawStringSize]]() function to help calculate the proper fontSize value to use.
+
|- valign="top"
 
+
|'''Example(s)||<source lang="lsl">
If a negative '''fontSize''' parameter is specified, any text subsequently added will be displayed upside down and to the right of the point of origin.
+
 
+
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 40: Line 36:
 
</source>
 
</source>
  
 +
|}
  
 +
Appends a [[Drawing_commands#FontSize|FontSize]] drawing command to the string provided in '''drawList''' and returns the result.
 +
 +
Sets the size of the font used by subsequent '''[[OsDrawText | osDrawTextText]]'''() calls. The '''fontSize''' parameter represents the font height in points.
 +
 +
Please note that the font height is given in ''points'', not in ''pixels''. The resulting size of the font in pixels may vary depending on the system settings, specifically the display system's "dots per inch" metric.  A system set to 96dpi will produce differently sized text than a system set to 120dpi. If precise text size is required, consider using the [[osGetDrawStringSize]]() function to help calculate the proper fontSize value to use.
 +
 +
If a negative '''fontSize''' parameter is specified, any text subsequently added will be displayed upside down and to the right of the point of origin.
 +
 +
Please note that the pen position is ''not'' updated after this call.
  
[[Category:OSSL]]
+
[[Category:OSSL Functions]]
 
[[Category:OSSL functions without threat level]]
 
[[Category:OSSL functions without threat level]]

Revision as of 11:40, 11 June 2011

OsSetFontSize
Threat Level <Threat Level goes here>
Function Syntax
LSL: string osSetFontSize( string drawList, integer fontSize )
C#: string osSetFontSize( string drawList, int fontSize )
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 = osSetFontSize( CommandList, 10 );             // Use 10-point text
        CommandList = osDrawText( CommandList, "Ten points!" );     // Place some text
        CommandList = osMovePen( CommandList, 10, 27 );             // New text placement
        CommandList = osSetFontSize( CommandList, 15 );             // Use 10-point text
        CommandList = osDrawText( CommandList, "Fifteen points!" ); // Place some text
        CommandList = osMovePen( CommandList, 10, 50 );             // New text placement
        CommandList = osSetFontSize( CommandList, 20 );             // Use 10-point text
        CommandList = osDrawText( CommandList, "Twenty points!" );  // Place some text
 
        // Now draw the image
        osSetDynamicTextureData( "", "vector", CommandList, "width:256,height:256", 0 );
    }
}

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

Sets the size of the font used by subsequent osDrawTextText() calls. The fontSize parameter represents the font height in points.

Please note that the font height is given in points, not in pixels. The resulting size of the font in pixels may vary depending on the system settings, specifically the display system's "dots per inch" metric. A system set to 96dpi will produce differently sized text than a system set to 120dpi. If precise text size is required, consider using the osGetDrawStringSize() function to help calculate the proper fontSize value to use.

If a negative fontSize parameter is specified, any text subsequently added will be displayed upside down and to the right of the point of origin.

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

Personal tools
General
About This Wiki