natives.setTextScale: Difference between revisions
Jump to navigation
Jump to search
ChrisGame20 (talk | contribs) (Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.setTextScale |parameters = float xScale, float yScale |parameter1 = float xScale Horizontal scale factor for the text (0.20) |parameter2 = float yScale Vertical scale factor for the text (0.40) |usage = Sets the horizontal and vertical scale of text drawn on the screen |notes = - Set the scale in the same frame before calling natives.displayTextWithLiteralString or other text draw functions...") |
ChrisGame20 (talk | contribs) No edit summary |
||
| Line 24: | Line 24: | ||
natives.setTextDropshadow(true, 0, 0, 0, 255); | natives.setTextDropshadow(true, 0, 0, 0, 255); | ||
natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", " | natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", "Visible text of medium size (0.30)"); | ||
}); | }); | ||
}} | }} | ||
Latest revision as of 12:10, 28 November 2025
Function Client Only ![]()
Online and Offline
Available since Client 1.0.0
void natives.setTextScale(float xScale, float yScale)
The natives.setTextScale function is used to Sets the horizontal and vertical scale of text drawn on the screen.
Parameters
| 1) | float | xScale | Horizontal scale factor for the text (0.20). |
| 2) | float | yScale | Vertical scale factor for the text (0.40). |
Return
| void | This function doesn't return a value. |
Notes
- - Set the scale in the same frame before calling natives.displayTextWithLiteralString or other text draw functions- Recommended starting value is 0.20 for visibility; medium sizes are typically 0.20–0.40- Larger sizes: 0.50–0.80 (large), >0.80 (extra-large). The engine accepts values above 1.0- X and Y are independent: you can stretch or compress text by using different scales.
Examples
Example 1 - JavaScript:
addEventHandler("OnDrawnHUD", function() {
// Medium readable size natives.setTextScale(0.30, 0.30); natives.setTextFont(0); natives.setTextColour(255, 255, 255, 255); natives.setTextCentre(false); natives.setTextProportional(true); natives.setTextDropshadow(true, 0, 0, 0, 255);
natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", "Visible text of medium size (0.30)");
});
Compatibility
There isn't any compatibility information for this function.