natives.setTextFont: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
(Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.setTextFont |parameters = int fontId |parameter1 = int fontId Font style index (0–8 available) |usage = Sets the font style used for text drawn on the screen |notes = - Must be called before natives.displayTextWithLiteralString or similar text drawing functions - Available font IDs range from 0 to 8 - Each font ID corresponds to a different style; some may look similar depending on the ga...")
 
(No difference)

Latest revision as of 12:15, 28 November 2025

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.setTextFont(int fontId)

The natives.setTextFont function is used to Sets the font style used for text drawn on the screen.

Parameters

1) int fontId Font style index (0–8 available).

Return

void This function doesn't return a value.

Notes

  • - Must be called before natives.displayTextWithLiteralString or similar text drawing functions- Available font IDs range from 0 to 8- Each font ID corresponds to a different style; some may look similar depending on the game build- Common usage: 0 for default HUD font, higher values for stylized text.

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // Configure text style with font 0
   natives.setTextScale(0.30, 0.30);
   natives.setTextFont(0);
   natives.setTextColour(255, 255, 255, 255);
   natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", "Text with font size 0");

});

Compatibility

There isn't any compatibility information for this function.

Related

Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png font.measure
icon-iii.png icon-vc.png icon-sa.png icon-iv.png font.render
icon-iii.png icon-vc.png icon-sa.png icon-iv.png font.size