Customize font of floating text

This commit is contained in:
konaka
2025-11-08 12:38:19 +08:00
parent bdcd3c0b41
commit 41f2a2d81b
2 changed files with 95 additions and 11 deletions
+29 -1
View File
@@ -242,6 +242,22 @@ local function UnitXP_SP3_combatTextSP3_fontSize(size)
return UnitXP_SP3_Addon["combatTextSP3_fontSize"];
end
local function UnitXP_SP3_combatTextSP3_fontName(name)
local test, result, reloadResult = pcall(UnitXP, "combatTextSP3", "setFontName", name);
if not test then
if not skipUpdateMessage then
skipUpdateMessage = true;
UnitXP_SP3_Print(
"UnitXP_SP3.dll failed to execute \"combatTextSP3 setFontName\". You might need to update UnitXP_SP3.dll to support this method.");
end
return UnitXP_SP3_Addon["combatTextSP3_fontName"];
end
UnitXP_SP3_Addon["combatTextSP3_fontName"] = result;
return UnitXP_SP3_Addon["combatTextSP3_fontName"];
end
local function UnitXP_SP3_combatTextSP3_nameplateHeight(size)
local test, result = pcall(UnitXP, "combatTextSP3", "setNameplateHeight", size);
@@ -448,6 +464,9 @@ local function UnitXP_SP3_reloadConfig()
UnitXP_SP3_combatTextSP3_nameplateHeight(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]);
xpsp3_editBox_combatTextSP3_nameplateHeight:SetNumber(UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"]);
UnitXP_SP3_combatTextSP3_fontName(UnitXP_SP3_Addon["combatTextSP3_fontName"]);
xpsp3_editBox_combatTextSP3_fontName:SetText(UnitXP_SP3_Addon["combatTextSP3_fontName"]);
UnitXP_SP3_setTargetingRangeConeFactor(UnitXP_SP3_Addon["targetingRangeConeFactor"]);
UnitXP_SP3_setCameraHeight(UnitXP_SP3_Addon["cameraHeight"]);
@@ -473,15 +492,19 @@ local function UnitXP_SP3_reloadConfig()
xpsp3_checkButton_combatTextSP3:SetChecked(true);
xpsp3_editBox_combatTextSP3_fontSize:Show();
xpsp3_editBox_combatTextSP3_nameplateHeight:Show();
xpsp3_editBox_combatTextSP3_fontName:Show();
xpsp3_fontString_combatTextSP3_fontSize:Show();
xpsp3_fontString_combatTextSP3_nameplateHeight:Show();
xpsp3_fontString_combatTextSP3_fontName:Show();
else
UnitXP_SP3_combatTextSP3("disable");
xpsp3_checkButton_combatTextSP3:SetChecked(false);
xpsp3_editBox_combatTextSP3_fontSize:Hide();
xpsp3_editBox_combatTextSP3_nameplateHeight:Hide();
xpsp3_editBox_combatTextSP3_fontName:Hide();
xpsp3_fontString_combatTextSP3_fontSize:Hide();
xpsp3_fontString_combatTextSP3_nameplateHeight:Hide();
xpsp3_fontString_combatTextSP3_fontName:Hide();
end
if UnitXP_SP3_Addon["hideEXPtext"] then
@@ -583,6 +606,7 @@ function UnitXP_SP3_UI_OnClick(widget)
xpsp3_editBox_backgroundFPScap:ClearFocus();
xpsp3_editBox_combatTextSP3_fontSize:ClearFocus();
xpsp3_editBox_combatTextSP3_nameplateHeight:ClearFocus();
xpsp3_editBox_combatTextSP3_fontName:ClearFocus();
skipUpdateMessage = false;
@@ -600,6 +624,9 @@ function UnitXP_SP3_UI_OnClick(widget)
if string.find(widget:GetName(), "_combatTextSP3_nameplateHeight") then
UnitXP_SP3_combatTextSP3_nameplateHeight(widget:GetNumber());
end
if string.find(widget:GetName(), "_combatTextSP3_fontName") then
UnitXP_SP3_combatTextSP3_fontName(widget:GetText());
end
end
if string.find(widget:GetName(), "_button_") then
@@ -800,7 +827,7 @@ end
function UnitXP_SP3_OnEvent(event)
if event == "ADDON_LOADED" and arg1 == "UnitXP_SP3_Addon" then
local dataVersion = 31;
local dataVersion = 32;
if UnitXP_SP3_Addon == nil or UnitXP_SP3_Addon["dataVersion"] ~= dataVersion then
UnitXP_SP3_Addon = {};
UnitXP_SP3_Addon["dataVersion"] = dataVersion;
@@ -821,6 +848,7 @@ function UnitXP_SP3_OnEvent(event)
UnitXP_SP3_Addon["combatTextSP3"] = false;
UnitXP_SP3_Addon["combatTextSP3_fontSize"] = 40;
UnitXP_SP3_Addon["combatTextSP3_nameplateHeight"] = 55;
UnitXP_SP3_Addon["combatTextSP3_fontName"] = "Cambria";
UnitXP_SP3_Addon["hideEXPtext"] = false;
UnitXP_SP3_Addon["notify_flashTaskbarIcon"] = {};