Skip to content

Commit

Permalink
Workaround fonts not loading correctly on first login
Browse files Browse the repository at this point in the history
To reproduce issue before this change, install Prat-3.0, set an aura with text or subtext using font DorisPP, and text should not show, it will work after a /reload but will break if you restart wow client
  • Loading branch information
mrbuds committed Oct 18, 2023
1 parent 5eb25bf commit 7143abd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions WeakAuras/RegionTypes/Text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ local function modify(parent, region, data)

local fontPath = SharedMedia:Fetch("font", data.font);
text:SetFont(fontPath, data.fontSize, data.outline);
if not text:GetFont() and fontPath then -- workaround font not loading correctly
local objectName = "WeakAuras-Font-" .. data.text_font
local fontObject = _G[objectName] or CreateFont(objectName)
fontObject:SetFont(fontPath, data.text_fontSize, data.text_fontType)
text:SetFontObject(fontObject)
end
if not text:GetFont() then -- Font invalid, set the font but keep the setting
text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline);
end
Expand Down
6 changes: 6 additions & 0 deletions WeakAuras/SubRegionTypes/SubText.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ local function modify(parent, region, parentData, data, first)

local fontPath = SharedMedia:Fetch("font", data.text_font);
text:SetFont(fontPath, data.text_fontSize, data.text_fontType);
if not text:GetFont() and fontPath then -- workaround font not loading correctly
local objectName = "WeakAuras-Font-" .. data.text_font
local fontObject = _G[objectName] or CreateFont(objectName)
fontObject:SetFont(fontPath, data.text_fontSize, data.text_fontType)
text:SetFontObject(fontObject)
end
if not text:GetFont() then -- Font invalid, set the font but keep the setting
text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize, data.text_fontType);
end
Expand Down

0 comments on commit 7143abd

Please sign in to comment.