M MY Multiplayer: Wiki
Side
Kind

dxCreateFont

Client

Creates a font from a font file in the resource, for the text functions.

element|false dxCreateFont(string filepath [, int size = 9, bool bold = false, string quality = proof, string name = ""])

Parameters

NameTypeDescription
filepathstringPath of the font file (for example .ttf).
sizeintSize, from 5 to 150. Values outside are clamped.default 9
boldboolUse bold.default false
qualitystringQuality: default, draft, proof, nonantialiased, antialiased, cleartype or cleartype_natural. Only nonantialiased turns smoothing off.default proof
namestringName to use the font by in the text functions, as a string. Empty makes an unnamed font.default ""

Returns

The font element, or false when the file could not be read or the font could not be made.

Example

local title = dxCreateFont("fonts/Montserrat-Bold.ttf", 18, false, "antialiased", "title")

addEventHandler("onClientRender", root, function()
    dxDrawText("MYMP", 20, 20, 0, 0, tocolor(255, 255, 255), 1, title)
    dxDrawText("Roleplay", 20, 60, 0, 0, tocolor(255, 255, 255), 1, "title")
end)

See also