From 804dacb0248e1c74536b63afcdfb5b22973d909a Mon Sep 17 00:00:00 2001 From: d87 Date: Fri, 19 Jul 2019 18:15:38 +0700 Subject: [PATCH] options to change fonts --- Aptechka.lua | 5 ++++- Options/AptechkaOptions.lua | 39 +++++++++++++++++++++++++++++++++++++ frame.lua | 30 ++++++++++++++++------------ 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/Aptechka.lua b/Aptechka.lua index 5b5adcb..4e3d30f 100644 --- a/Aptechka.lua +++ b/Aptechka.lua @@ -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) diff --git a/Options/AptechkaOptions.lua b/Options/AptechkaOptions.lua index 17021ee..99f9ff0 100644 --- a/Options/AptechkaOptions.lua +++ b/Options/AptechkaOptions.lua @@ -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 = { diff --git a/frame.lua b/frame.lua index 395d5c8..cafdc57 100644 --- a/frame.lua +++ b/frame.lua @@ -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) @@ -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 @@ -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") @@ -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)