Back to Home

ESO Lua File v100035

libraries/utility/zo_labelutils.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local g_labelControl = nil
local function GetLabelControl()
    if not g_labelControl then
        g_labelControl = WINDOW_MANAGER:CreateControl("ZO_LabelUtils_UtilityLabel", GuiRoot, CT_LABEL)
    end
    return g_labelControl
end
local function GetConfiguredLabelControl(text, fontDescriptor, optionalLabelWidth, optionalLabelHeight)
    local control = GetLabelControl()
    control:SetFont(fontDescriptor)
    control:SetWidth(optionalLabelWidth)
    control:SetHeight(optionalLabelHeight)
    control:SetText(text)
    return control
end
function ZO_LabelUtils_GetNumLines(text, fontDescriptor, optionalLabelWidth, optionalLabelHeight)
    local control = GetConfiguredLabelControl(text, fontDescriptor, optionalLabelWidth, optionalLabelHeight)
    return control:GetNumLines()
end
function ZO_LabelUtils_GetTextDimensions(text, fontDescriptor, optionalLabelWidth, optionalLabelHeight)
    local control = GetConfiguredLabelControl(text, fontDescriptor, optionalLabelWidth, optionalLabelHeight)
    return control:GetTextDimensions()
end
function ZO_LabelUtils_GetFontHeight(fontDescriptor)
    local NO_TEXT = nil
    local control = GetConfiguredLabelControl(NO_TEXT, fontDescriptor)
    return control:GetFontHeight()
end