addon/Addon/Code/FontUtils.lua
Roman Jaroš 7a12abeda3
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good
Improve QuestFrame font handling
2025-03-08 22:57:39 +01:00

32 lines
No EOL
1.1 KiB
Lua

local _, addon = ...
local FontPath = "Interface\\AddOns\\CzechQuests\\Assets\\Fonts\\"
local TestFont = UIParent:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
TestFont:SetPoint("TOP", UIParent, "BOTTOM", 0, -64);
local function CreateCzechFont(frame, name, size, flags)
local font = frame:CreateFontString(nil, "OVERLAY")
font:SetTextColor(0, 0, 0, 1)
font:SetJustifyH("LEFT")
font:SetWidth(frame:GetWidth())
font:SetFont(FontPath ..name, size, flags or "")
return font
end
addon.API.CreateCzechFont = CreateCzechFont
local function UpdateCzechFont(FontString, name, size)
local _, _, flags = FontString:GetFont()
FontString:SetFont(FontPath .. name, size, flags)
end
addon.API.UpdateCzechFont = UpdateCzechFont
local function GetFontContainer()
local container = Settings.CreateControlTextContainer()
container:Add("morpheus_cz.ttf", "Morpheus (cz)")
container:Add("frizquadratatt_cz.ttf", "Friz Quadrata TT (cz)")
container:Add("quicksand.ttf", "Quicksand")
container:Add("caveat.ttf", "Caveat")
return container:GetData()
end
addon.API.GetFontContainer = GetFontContainer