-------------------------
-- Sphere Font Creator --
-------------------------
local addon, ns = ...
local ss = ns.SS

local setmetatable = setmetatable
local CreateFrame = CreateFrame

local mtFont = {};

function mtFont:New(parent, displayMode, c1, c2, dual)
  local fontFrameLevel = (displayMode == "active") and 4 or (4 + ss.private.layout.config.frameLevelAdjust)
  local frameStrata    = ((displayMode == "active") and "MEDIUM" or "HIGH")

  local fontHolder = CreateFrame("FRAME", ss._f..parent.configName.."_fontholder", parent)
  fontHolder:SetFrameStrata(frameStrata)
  fontHolder:SetAllPoints  (parent)
  fontHolder:SetFrameLevel (fontFrameLevel)

  local font1 = fontHolder:CreateFontString(nil,"OVERLAY")
  local font2 = fontHolder:CreateFontString(nil,"OVERLAY")

  self:SetFonts(font1,font2,dual)

  font1:SetTextColor(ss:GetRGBAValues(c1))
  font2:SetTextColor(ss:GetRGBAValues(c2))

  return fontHolder, font1, font2
end

function mtFont:SetFonts(font1, font2, dual)
  if dual then
    font1:SetFont (ss.private.font.sphere, ss.private.fontSize.sphereSmall, ss.private.fontFlag.sphere)
    font1:SetPoint("CENTER",-20,5)
    font2:SetFont (ss.private.font.sphere, ss.private.fontSize.sphereSmall, ss.private.fontFlag.sphere)
    font2:SetPoint("CENTER",20,5)
  else
    font1:SetFont (ss.private.font.sphere, ss.private.fontSize.sphereLarge, ss.private.fontFlag.sphere)
    font1:SetPoint("CENTER",0,15)
    font2:SetFont (ss.private.font.sphere, ss.private.fontSize.sphereMedium, ss.private.fontFlag.sphere)
    font2:SetPoint("CENTER",0,-5)
  end
end

ss["FontCreator"] = setmetatable({}, { __index = mtFont });
