OsSetFontSize

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Page created.)
 
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Template:Quicklinks}}
+
{{osslfunc
[[Technical Reference | Technical Reference]] -> [[Technical Reference/terms | Terms]] -> [[Status | Status Page]] -> [[OSSL_Implemented| OSSL Implemented Functions]] -> [[Dynamic textures]] -> [[OsSetFontSize | osSetFontSize]]
+
|threat_level=ignored
 
+
|permissions=true
 
+
|delay=0
LSL: '''[[string]] osSetFontSize( [[string]] drawList, [[integer]] fontSize )'''<br />
+
|function_syntax=string osSetFontSize(string drawList, integer fontSize)
C#: '''[[string]] osSetFontSize( [[string]] drawList, [[int]] fontSize )'''
+
|ossl_example=<source lang="lsl">
 
+
 
+
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.
+
 
+
Example:
+
<source lang="lsl">
+
 
// Example of osDrawText
 
// Example of osDrawText
 
default
 
default
Line 41: Line 27:
 
}
 
}
 
</source>
 
</source>
 +
|description=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.
 +
|
 +
}}

Latest revision as of 13:38, 14 November 2018

string osSetFontSize(string drawList, integer fontSize)
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.

Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
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 );
    }
}


Personal tools
General
About This Wiki