-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFonts.lua
49 lines (37 loc) · 1.2 KB
/
Fonts.lua
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
local Recount = _G.Recount
local SM = LibStub:GetLibrary("LibSharedMedia-3.0")
local revision = tonumber(string.sub("$Revision: 1254 $", 12, -3))
if Recount.Version < revision then
Recount.Version = revision
end
local pairs = pairs
local FontStrings = {}
local FontFile
--First thing first need to add fonts
--SM:Register("font", "Vera", [[Interface\AddOns\Recount\Fonts\Vera.ttf]])
-- removed ABF.ttf by request from Curse (Arrowmaster)
-- tried DejaVu, crashes client if resized too big
-- tried Bitstream Vera, crashes client if resized too big
-- Hence reverting to Arial Narrow as default font, sorry.
function Recount:AddFontString(string)
local Font, Height, Flags
FontStrings[#FontStrings + 1] = string
if not FontFile and Recount.db.profile.Font then
FontFile = SM:Fetch("font", Recount.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 Recount:SetFont(fontname)
local Height, Flags
Recount.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