Skip to content

Commit

Permalink
options to change fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Jul 19, 2019
1 parent fba7061 commit 804dacb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 13 deletions.
5 changes: 4 additions & 1 deletion Aptechka.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ local defaults = {
damageBigRaid = 0.7,
healerMediumRaid = 1,
healerBigRaid = 0.8,
}
},
nameFontName = "ClearFont",
nameFontSize = 12,
stackFontSize = 12,
}

local function SetupDefaults(t, defaults)
Expand Down
39 changes: 39 additions & 0 deletions Options/AptechkaOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,45 @@ local function MakeGeneralOptions()
end,
values = LSM:HashTable("statusbar"),
dialogControl = "LSM30_Statusbar",
},

nameFont = {
type = "select",
name = "Font",
order = 14.1,
get = function(info) return Aptechka.db.nameFont end,
set = function(info, value)
Aptechka.db.nameFont = value
Aptechka:ReconfigureUnprotected()
end,
values = LSM:HashTable("font"),
dialogControl = "LSM30_Font",
},
nameFontSize = {
name = "Name Font Size",
type = "range",
get = function(info) return Aptechka.db.nameFontSize end,
set = function(info, v)
Aptechka.db.nameFontSize = v
Aptechka:ReconfigureUnprotected()
end,
min = 3,
max = 30,
step = 0.5,
order = 14.2,
},
stackFontSize = {
name = "Stack Font Size",
type = "range",
get = function(info) return Aptechka.db.stackFontSize end,
set = function(info, v)
Aptechka.db.stackFontSize = v
Aptechka:ReconfigureUnprotected()
end,
min = 3,
max = 30,
step = 0.1,
order = 14.2,
},

inverted = {
Expand Down
30 changes: 18 additions & 12 deletions frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local pixelperfect = helpers.pixelperfect
local LSM = LibStub("LibSharedMedia-3.0")

LSM:Register("statusbar", "Gradient", [[Interface\AddOns\Aptechka\gradient.tga]])
LSM:Register("font", "ClearFont", [[Interface\AddOns\Aptechka\ClearFont.ttf]], GetLocale() ~= "enUS" and 15)


local SetJob_Frame = function(self, job)
Expand Down Expand Up @@ -552,19 +553,13 @@ local CreateIcon = function(parent,w,h,alpha,point,frame,to,x,y)
local stackframe = CreateFrame("Frame", nil, icon)
stackframe:SetAllPoints(icon)
local stacktext = stackframe:CreateFontString(nil,"OVERLAY")
-- stacktext:SetWidth(w)
-- stacktext:SetHeight(h)
if AptechkaDefaultConfig.font then
stacktext:SetFont(AptechkaDefaultConfig.font,11,"OUTLINE")
else
stacktext:SetFontObject("NumberFontNormal")
end
local stackFont = LSM:Fetch("font", Aptechka.db.nameFontName)
local stackFontSize = Aptechka.db.stackFontSize
stacktext:SetFont(stackFont, stackFontSize, "OUTLINE")
stackframe:SetFrameLevel(7)

stacktext:SetJustifyH"RIGHT"
stacktext:SetPoint("BOTTOMRIGHT",icon,"BOTTOMRIGHT",0,0)
-- /script NugRaid1UnitButton1.dicon1:Show(); NugRaid1UnitButton1.dicon1.stacktext:Show(); NugRaid1UnitButton1.dicon1.stacktext:SetText"3"
-- stacktext:SetPoint("TOPLEFT",icon,"TOPLEFT",-w,h)
stacktext:SetPoint("BOTTOMRIGHT",icon,"BOTTOMRIGHT",0,-1)
stacktext:SetTextColor(1,1,1)
icon.stacktext = stacktext
icon.SetJob = SetJob_Icon
Expand Down Expand Up @@ -955,6 +950,17 @@ local function Reconf(self)
Aptechka.FrameSetJob(self,config.PowerBarColor,true)
Aptechka.FrameSetJob(self,config.UnitNameStatus,true)

local nameFont = LSM:Fetch("font", Aptechka.db.nameFontName)
local nameFontSize = Aptechka.db.nameFontSize
self.text1:SetFont(nameFont, nameFontSize)

local stackFont = nameFont
local stackFontSize = Aptechka.db.stackFontSize
self.dicon1.stacktext:SetFont(stackFont, stackFontSize, "OUTLINE")
self.dicon2.stacktext:SetFont(stackFont, stackFontSize, "OUTLINE")
self.dicon3.stacktext:SetFont(stackFont, stackFontSize, "OUTLINE")
self.dicon4.stacktext:SetFont(stackFont, stackFontSize, "OUTLINE")

if isVertical then
self.health:SetOrientation("VERTICAL")
self.power:SetOrientation("VERTICAL")
Expand Down Expand Up @@ -1032,8 +1038,8 @@ AptechkaDefaultConfig.GridSkin = function(self)

local texture = config.texture
local powertexture = texture
local font = config.font
local fontsize = config.fontsize
local font = LSM:Fetch("font", Aptechka.db.nameFontName)
local fontsize = Aptechka.db.nameFontSize
local manabar_width = config.manabarwidth
local border = pixelperfect(2)

Expand Down

0 comments on commit 804dacb

Please sign in to comment.