forked from ZMOT7S/Spy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFonts.lua
More file actions
34 lines (26 loc) · 745 Bytes
/
Fonts.lua
File metadata and controls
34 lines (26 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local FontStrings={}
local FontFile
local SM = LibStub:GetLibrary("LibSharedMedia-3.0")
SM:Register("font", "ABF", [[Interface\AddOns\Spy\Fonts\ABF.ttf]])
function Spy:AddFontString(string)
local Font, Height, Flags
FontStrings[#FontStrings+1] = string
if not FontFile and Spy.db.profile.Font then
FontFile = SM:Fetch("font", Spy.db.profile.Font)
end
if FontFile then
Font, Height, Flags = string:GetFont()
if Font ~= FontFile then
string:SetFont(FontFile, Height, Flags)
end
end
end
function Spy:SetFont(fontname)
local Height, Flags
Spy.db.profile.Font = fontname
FontFile = SM:Fetch("font",fontname)
for _, v in pairs(FontStrings) do
_, Height, Flags = v:GetFont()
v:SetFont(FontFile, Height, Flags)
end
end