M MY Multiplayer: Wiki
Side
Kind

dxGetFontHeight

Client

Returns the height of one line of text in a font.

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

Parameters

NameTypeDescription
scalefloatText scale.default 1
fontstring|elementA font's name (from a pack or given to dxCreateFont) or a font element from dxCreateFont.default default

Returns

The height in pixels, or false when the font does not exist.

Example

local lines = { "Vida", "Colete", "Dinheiro" }
local lineHeight = dxGetFontHeight(1.5, "default")

addEventHandler("onClientRender", root, function()
    for i, line in ipairs(lines) do
        dxDrawText(line, 20, 200 + (i - 1) * lineHeight, 0, 0, tocolor(255, 255, 255), 1.5)
    end
end)

See also