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

Function

dxGetFontHeight

ClientDrawing (dx)Identical to MTA:SA

Returns the height of one line of text in pixels for a scale and a font.

Syntax

float dxGetFontHeight([float scale = 1, string|font font = "default"])

Arguments

scalefloat, optional = 1
Scale.
fontstring|font, optional = "default"
Font.

Returns

Line height.

Example

local lineH = dxGetFontHeight(1, "default-bold")
addEventHandler("onClientRender", root, function()
    for i, line in ipairs({ "Linia 1", "Linia 2" }) do
        dxDrawText(line, 20, 300 + (i - 1) * lineH)
    end
end)

See also