Quantcast

Titan : cleanup fix for font :)

urnati [03-14-26 - 17:09]
Titan : cleanup fix for font :)
Filename
Titan/Titan.lua
Titan/TitanConfig.lua
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index a12402b..e58ce4c 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -201,29 +201,6 @@ function TitanPanel_SaveCustomProfile(profile_name)
 	--	StaticPopupDialogs["TITAN_SAVE_CUSTOM_PROFILE"] = {}
 end

---[[
----Titan Set or change the font and font size of text on the Titan bar. This affects ALL plugins.
---- Each registered plugin will have its font updated. Then all plugins will be refreshed to show the new font.
----@param fontname string path to font file
----@param fontsize number in points
-function TitanSetPanelFont(fontname, fontsize)
-	-- a couple of arg checks to avoid unpleasant things...
-	if not fontname then fontname = TPC.FONT_NAME end
-	if not fontsize then fontsize = TPC.FONT_SIZE end
-	local newfont = media:Fetch("font", fontname)
-	for index, id in pairs(TitanPluginsIndex) do
-		local button = TitanUtils_GetButton(id)
-		if button then
-			local buttonText = _G[button:GetName() .. TITAN_PANEL_TEXT];
-			if buttonText then
-				buttonText:SetFont(newfont, fontsize);
-			end
-		end
-	end
-	TitanPanel_RefreshPanelButtons();
-end
---]]
-
 local function RegisterForEvents()
 	-- Need to be careful of regeristering for events that initiate
 	-- show / hide of Bars before the Bars can be initialized...
@@ -1745,8 +1722,6 @@ function TitanPanel_InitPanelButtons(reason)
 	-- 2026 Feb : Added setting scale and font on bars and plugins here to consolidate
 	-- processing and reduce routines and hopefully be clearer for future changes
 	local scale = TitanPanelGetVar("Scale");
-	local font_name = TitanPanelGetVar("FontName")
-	local font_size = TitanPanelGetVar("FontSize")

 	local button_spacing = TitanPanelGetVar("ButtonSpacing") * scale
 	local icon_spacing = TitanPanelGetVar("IconSpacing") * scale
@@ -1792,12 +1767,9 @@ function TitanPanel_InitPanelButtons(reason)
 			button = TitanUtils_GetButton(id);

 			if button then
-				button:SetScale(scale)
-				local buttonText = _G[button:GetName() .. TITAN_PANEL_TEXT];
-				if buttonText then
-					buttonText:SetFont(font_name, font_size);
-				end
-
+				-- Should help with spacing on init
+				-- At point of need on config change rather than looping over plugins
+				TitanPanelButton_UpdateButton(id)
 				-- If the plugin has asked to be on the right
 				if TitanUtils_ToRight(id) then
 					-- =========================
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 370a5e2..8e5f0d6 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -2359,7 +2359,6 @@ local function CreateUIOptions(pos)
 				end,
 				set = function(_, v)
 					TitanPanelSetVar("FontName", v)
-					--TitanSetPanelFont(v, TitanPanelGetVar("FontSize"))
 					TitanPanel_InitPanelButtons("FontName")
 				end,
 				values = font_list,
@@ -2378,7 +2377,6 @@ local function CreateUIOptions(pos)
 				get = function() return TitanPanelGetVar("FontSize") end,
 				set = function(_, v)
 					TitanPanelSetVar("FontSize", v);
-					--TitanSetPanelFont(TitanPanelGetVar("FontName"), v)
 					TitanPanel_InitPanelButtons("FontSize")
 				end,
 			},