From 5da4a70d343e933f7af685057a0c4edcbb0cfa48 Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 7 Jun 2017 18:53:48 +0200 Subject: [PATCH] nameplates: add option to use unit font --- api/config.lua | 1 + modules/gui.lua | 1 + modules/nameplates.lua | 13 ++++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/api/config.lua b/api/config.lua index b6784feb..398adfb7 100644 --- a/api/config.lua +++ b/api/config.lua @@ -398,6 +398,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("chat", "global", "fadeout", "0") pfUI:UpdateConfig("chat", "global", "fadetime", "300") + pfUI:UpdateConfig("nameplates", nil, "use_unitfonts", "1") pfUI:UpdateConfig("nameplates", nil, "showcastbar", "1") pfUI:UpdateConfig("nameplates", nil, "spellname", "0") pfUI:UpdateConfig("nameplates", nil, "showdebuffs", "0") diff --git a/modules/gui.lua b/modules/gui.lua index 1dc56a56..85d8637c 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1248,6 +1248,7 @@ pfUI:RegisterModule("gui", function () -- nameplates pfUI.gui.nameplates = pfUI.gui:CreateConfigTab("Nameplates") + pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Use Unit Fonts", C.nameplates, "use_unitfonts", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Enable Castbars", C.nameplates, "showcastbar", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Enable Spellname", C.nameplates, "spellname", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Enable Debuffs", C.nameplates, "showdebuffs", "checkbox") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index c50f5230..5b0f753f 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1,4 +1,7 @@ pfUI:RegisterModule("nameplates", function () + local font = C.nameplates.use_unitfonts == "1" and pfUI.font_square or pfUI.font_default + local font_size = C.nameplates.use_unitfonts == "1" and C.global.font_square_size or C.global.font_size + pfUI.nameplates = CreateFrame("Frame", nil, UIParent) pfUI.nameplates.mobs = {} pfUI.nameplates.targets = {} @@ -75,9 +78,9 @@ pfUI:RegisterModule("nameplates", function () raidicon:SetPoint("CENTER", healthbar, "CENTER", 0, -5) -- adjust font - name:SetFont(pfUI.font_default,12,"OUTLINE") + name:SetFont(font, font_size, "OUTLINE") name:SetPoint("BOTTOM", healthbar, "CENTER", 0, 7) - level:SetFont(pfUI.font_default,12, "OUTLINE") + level:SetFont(font, font_size, "OUTLINE") level:ClearAllPoints() level:SetPoint("RIGHT", healthbar, "LEFT", -1, 0) levelicon:ClearAllPoints() @@ -143,7 +146,7 @@ pfUI:RegisterModule("nameplates", function () healthbar.castbar.text:SetNonSpaceWrap(false) healthbar.castbar.text:SetFontObject(GameFontWhite) healthbar.castbar.text:SetTextColor(1,1,1,.5) - healthbar.castbar.text:SetFont(pfUI.font_default, 10, "OUTLINE") + healthbar.castbar.text:SetFont(font, font_size - 2, "OUTLINE") end if healthbar.castbar.spell == nil then @@ -152,7 +155,7 @@ pfUI:RegisterModule("nameplates", function () healthbar.castbar.spell:SetNonSpaceWrap(false) healthbar.castbar.spell:SetFontObject(GameFontWhite) healthbar.castbar.spell:SetTextColor(1,1,1,1) - healthbar.castbar.spell:SetFont(pfUI.font_default, 10, "OUTLINE") + healthbar.castbar.spell:SetFont(font, font_size - 2, "OUTLINE") end if healthbar.castbar.icon == nil then @@ -181,7 +184,7 @@ pfUI:RegisterModule("nameplates", function () healthbar.hptext:SetNonSpaceWrap(false) healthbar.hptext:SetFontObject(GameFontWhite) healthbar.hptext:SetTextColor(1,1,1,1) - healthbar.hptext:SetFont(pfUI.font_default, 10) + healthbar.hptext:SetFont(font, font_size - 2) end end