- Documentation
- Client functions
- 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/.otffile 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)
<meta>
<script src="client.lua" type="client" />
<file src="fonty/gta.ttf" />
</meta>
See also
dxSetFontStyleChanges the style of a font fromdxCreateFont:bold,italic,underline,strike,weight,spacing,widthScale,shadow,outline,outlineColor,gradient,lineSpacing,size. Pass one key or a table.dxDrawTextDraws text on the screen for one frame. Call it inonClientRenderto keep it visible.dxGetFontInfoReturns a font description: the typeface (family), the size in pixels (px) and points (size), style settings and the source.