OsSetFontSize

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
{{Quicklinks}}
+
{{osslfunc|
 
+
threat_level = None
{| width="100%" style="border: thin solid black"
+
|
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
+
function_syntax = <source lang="lsl">
|- valign="top"
+
|'''Threat Level''' || None
+
 
+
|- valign="top"
+
|'''Function Syntax''' || <source lang="lsl">
+
 
LSL: string osSetFontSize( string drawList, integer fontSize )
 
LSL: string osSetFontSize( string drawList, integer fontSize )
 
C#: string osSetFontSize( string drawList, int fontSize )
 
C#: string osSetFontSize( string drawList, int fontSize )
 
</source>
 
</source>
|- valign="top"
+
|
|'''Example(s)||<source lang="lsl">
+
ossl_example = <source lang="lsl">
 
// Example of osDrawText
 
// Example of osDrawText
 
default
 
default
Line 35: Line 30:
 
}
 
}
 
</source>
 
</source>
 
+
|  
|}
+
additional_info = Appends a [[Drawing_commands#FontSize|FontSize]] drawing command to the string provided in '''drawList''' and returns the result.
 
+
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.  
 
Sets the size of the font used by subsequent '''[[OsDrawText | osDrawTextText]]'''() calls. The '''fontSize''' parameter represents the font height in points.  
Line 47: Line 40:
  
 
Please note that the pen position is ''not'' updated after this call.
 
Please note that the pen position is ''not'' updated after this call.
 
+
|
[[Category:OSSL Functions]]
+
}}

Revision as of 16:30, 12 June 2011

LSL: string osSetFontSize( string drawList, integer fontSize )
C#: string osSetFontSize( string drawList, int fontSize )
No descriptions provided
Threat Level None
Permissions No permissions specified
Extra Delay No function delay specified
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 );
    }
}
Notes
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