local addOnName = ...

local MIN_FONT_SIZE = 11
-- Raised from 34 to 48 for the break-reminder countdown label (BreakReminder.lua uses
-- WildThingsFont48 -- 3× the original 16px, visible from across the room during a
-- raid break). The loop below builds the regular/outline/bold/mono-num families per
-- size, so this one constant supplies all sizes.
local MAX_FONT_SIZE = 48

local ROMAN_FILE = string.format("Interface\\Addons\\%s\\Media\\Fonts\\Expressway.ttf", addOnName)
local ROMAN_FILE_BOLD = string.format("Interface\\Addons\\%s\\Media\\Fonts\\ExpresswayBold.ttf", addOnName)
local MONO_NUM_FILE = string.format("Interface\\Addons\\%s\\Media\\Fonts\\ExpresswayMonoNum.ttf", addOnName)
local KOREAN_FILE = "Fonts\\2002.TTF"
local SIMPLIFIED_CHINESE_FILE = "Fonts\\ARKai_C.ttf"
local TRADITIONAL_CHINESE_FILE = string.format("Interface\\Addons\\%s\\UI\\Media\\Fonts\\arheiuhk_bd.ttf", addOnName)
local RUSSIAN_FILE = "Fonts\\FRIZQT___CYR.TTF"

for fontSize = MIN_FONT_SIZE, MAX_FONT_SIZE do
    -- Regular font
    local fontName = string.format("WildThingsFont%d", fontSize)

    if not _G[fontName] then
        CreateFontFamily(
            fontName,
            {
                {alphabet = "roman", file = ROMAN_FILE, height = fontSize, flags = ""},
                {alphabet = "korean", file = KOREAN_FILE, height = fontSize, flags = ""},
                {alphabet = "simplifiedchinese", file = SIMPLIFIED_CHINESE_FILE, height = fontSize, flags = ""},
                {alphabet = "traditionalchinese", file = TRADITIONAL_CHINESE_FILE, height = fontSize, flags = ""},
                {alphabet = "russian", file = RUSSIAN_FILE, height = fontSize, flags = ""},
            }
        )
    end

    -- Outline font
    local fontNameOutline = string.format("WildThingsFont%d_Outline", fontSize)

    if not _G[fontNameOutline] then
        CreateFontFamily(
            fontNameOutline,
            {
                {alphabet = "roman", file = ROMAN_FILE, height = fontSize, flags = "OUTLINE"},
                {alphabet = "korean", file = KOREAN_FILE, height = fontSize, flags = "OUTLINE"},
                {alphabet = "simplifiedchinese", file = SIMPLIFIED_CHINESE_FILE, height = fontSize, flags = "OUTLINE"},
                {alphabet = "traditionalchinese", file = TRADITIONAL_CHINESE_FILE, height = fontSize, flags = "OUTLINE"},
                {alphabet = "russian", file = RUSSIAN_FILE, height = fontSize, flags = "OUTLINE"},
            }
        )
    end

    -- Bold font (700)
    local fontNameBold = string.format("WildThingsFontBold%d", fontSize)

    if not _G[fontNameBold] then
        CreateFontFamily(
            fontNameBold,
            {
                {alphabet = "roman", file = ROMAN_FILE_BOLD, height = fontSize, flags = ""},
                {alphabet = "korean", file = KOREAN_FILE, height = fontSize, flags = ""},
                {alphabet = "simplifiedchinese", file = SIMPLIFIED_CHINESE_FILE, height = fontSize, flags = ""},
                {alphabet = "traditionalchinese", file = TRADITIONAL_CHINESE_FILE, height = fontSize, flags = ""},
                {alphabet = "russian", file = RUSSIAN_FILE, height = fontSize, flags = ""},
            }
        )
    end

    -- Mono num font (digits-only, no multi-alphabet fallback needed)
    local fontNameNum = string.format("WildThingsFontNum%d", fontSize)

    if not _G[fontNameNum] then
        local fontObjNum = CreateFont(fontNameNum)
        fontObjNum:SetFont(MONO_NUM_FILE, fontSize, "")
    end
end
