natives.setTextScale

From GTA Connected
Revision as of 12:10, 28 November 2025 by ChrisGame20 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Client Only icon-iv.png 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.