ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxCreateFont

Function

dxCreateFont

Creates a font from a resource TTF/OTF file or from a system typeface (pass its name). The size is in points. Pass the font to dxDrawText and guiSetFont.

Syntax

font dxCreateFont(string filepath [, float size = 9, bool bold = false, string quality, table style])

Arguments

filepathstring
A .ttf/.otf file or a typeface name.
sizefloat, optional = 9
Size in points.
boldbool, optional = false
Bold.
qualitystring, optional
Accepted for compatibility with existing scripts.
styletable, optional
A style like in dxSetFontStyle.Not in MTA:SA

Differences from MTA:SA

  • Arguments in a different colour differ from MTA:SA.

In MTA:SA

dxCreateFont(string filepath, int size = 9, bool bold = false, string quality = "proof")

Returns

The font or false.

Example

local font = dxCreateFont("fonty/gta.ttf", 18)
addEventHandler("onClientRender", root, function()
    dxDrawText("Misja zaliczona", 0, 200, 1920, 260, tocolor(255, 200, 0), 1, font, "center")
end)

See also