FontString question

that should be fairly simple. as far as im aware you just have to re-set the size and flags each time so you just get those first then re-use the same values, or pass them through if you know what you want.

-- this is your global/const variable wher you store your font path
fontpath = [[Interface\AddOns\MyAddon\MyFontFolder\MyFont.ttf]]

-- get your fontstring object
local obj = MyAddon.frame.fontstring1
-- get the existing font data
local oldfont, size, flags = obj:GetFont( )
-- set the font
obj:SetFont( fontpath, size, flags )

if you set it once and never again then;

  • set it when you create the fontstring objects.

  • if you use xml then i think you need to hardcode its default font (you cant pass a variable here)
    <FontString name="$parentFontString1" font="Interface\Addons\MyAddon\MyFontFolder\MyFont.ttf" />