Quantcast

FONT SIZE default is now 13 (same as wow). Fixed an issue with blizz chat bubbles not resizing to the proper font size.

Christopher Tse [11-18-22 - 09:31]
FONT SIZE default is now 13 (same as wow). Fixed an issue with blizz chat bubbles not resizing to the proper font size.
Filename
BlizzChatIntegration.lua
ChatBubblePool.lua
Settings.lua
diff --git a/BlizzChatIntegration.lua b/BlizzChatIntegration.lua
index 0258015..8ec4b8f 100644
--- a/BlizzChatIntegration.lua
+++ b/BlizzChatIntegration.lua
@@ -77,21 +77,13 @@ local function skinBubble(chatBubble)
 		name = "";
 	end

-	local fontPath, _, fontFlags = fontString:GetFont();
-	fontString:SetFont(fontPath, fontSize, fontFlags);
-
 	local NameText = CreateFrame("EditBox","BlizzBoxNameText",chatBubble);
 	NameText:SetFrameStrata("MEDIUM"); --This is the default but better to be explicit
-	--NameText:SetMultiLine(true);
 	NameText:SetAutoFocus(false);
 	NameText:EnableMouse(false);
 	NameText:SetSize(700,11);
-	--NameText:SetPoint("CENTER");
 	NameText:SetPoint("BOTTOMLEFT",chatBubble,"TOPLEFT",13,2);
 	NameText:SetFontObject("GameFontNormal");
-	--local tex = NameText:CreateTexture(nil,"ARTWORK");
-	--tex:SetAllPoints()
-	--tex:SetTexture(255,255,255);
 	NameText.stringMeasure = NameText:CreateFontString(nil,"OVERLAY","GameFontNormal");

 	local NameBg = CreateFrame("Frame","BlizzBubbleNameBG",NameText);
@@ -100,7 +92,6 @@ local function skinBubble(chatBubble)
 	NameBg:SetWidth(NameText.stringMeasure:GetStringWidth());
 	NameBg:SetFrameStrata("BACKGROUND");

-
 	local midTex = NameBg:CreateTexture("nameBoxBackgroundTex-middle","BACKGROUND");
 	midTex:SetTexture("Interface/CHATFRAME/ChatFrameTab-BGMid.blp");
 	midTex:SetPoint("TOPLEFT",8,0);
@@ -116,7 +107,6 @@ local function skinBubble(chatBubble)

 	local relativeTo, relativePoint, xOfs, yOfs = getNamedPoint(chatBubble,"BOTTOMRIGHT");
 	chatBubble.string = relativeTo;
-	--chatBubble.string:SetJustifyH("LEFT");
 	chatBubble.defaultXOfs = xOfs;
 	chatBubble.fixWidth = function(self)
 		local nameWidth = NameText.stringMeasure:GetWidth();
@@ -134,7 +124,7 @@ local function skinBubble(chatBubble)
 			frame:SetPoint("BOTTOMRIGHT",relativeTo,"BOTTOMRIGHT",defaultXOfs+adj,yOfs);
 		else
 			frame:SetPoint("TOPLEFT",relativeTo,"TOPLEFT",-defaultXOfs,-yOfs);
-			frame:SetPoint("BOTTOMRIGHT",relativeTo,relativePoint,defaultXOfs,yOfs);
+			frame:SetPoint("BOTTOMRIGHT",relativeTo,"BOTTOMRIGHT",defaultXOfs,yOfs);
 		end
 		local _, _, newX, newY = getNamedPoint(self,"BOTTOMRIGHT");
 	end
diff --git a/ChatBubblePool.lua b/ChatBubblePool.lua
index a682a12..83f6d9d 100644
--- a/ChatBubblePool.lua
+++ b/ChatBubblePool.lua
@@ -273,8 +273,6 @@ local function createChatBubble(fontSize)
 	editBox:SetScript("OnEnterPressed", function(self) if IsShiftKeyDown() then self:Insert("\n") else self:ClearFocus() end end);
 	editBox:SetScript("OnEscapePressed",clearFocusAndSelection);

-	local fontPath, _, fontFlags = editBox:GetFont();
-	editBox:SetFont(fontPath, fontSize, fontFlags);
 	--Apparently, the below code stops the user from being able to change the cursor location
 	--editBox:EnableMouse(true)
 	--editBox:SetScript("OnMouseDown", function(self) newChatBubble:StartMoving() end )
@@ -303,7 +301,6 @@ local function createChatBubble(fontSize)
 	--We use an invisible FontString to measure the length of the text inside the edit box.
 	editBox.stringMeasure = editBox:CreateFontString(nil,"OVERLAY","ChatBubbleFont");
 	editBox.stringMeasure:SetAlpha(0);
-	editBox.stringMeasure:SetFont(fontPath, fontSize, fontFlags);
 	editBox:SetScript("OnTextChanged", function(self)
 	    editBox.stringMeasure:SetText(self:GetText());
 		adjustChatBubbleWidth(newChatBubble);
diff --git a/Settings.lua b/Settings.lua
index a069216..ce7fec3 100644
--- a/Settings.lua
+++ b/Settings.lua
@@ -17,7 +17,7 @@ defaultValue = {
 	GENERATE_TOTAL_RP3_BUBBLES = true,
 	GENERATE_TOTAL_RP3_BUBBLES_FOR_OTHER_PLAYERS = true,

-	FONT_SIZE = 14
+	FONT_SIZE = 13
 }

 local temporaryValue = {}
@@ -40,15 +40,16 @@ function initSettings()
 	Import.settings = settings;
 	ConstructSettingsUI();
 	hooksecurefunc(SettingsPanel, "FinalizeCommit", CommitChanges);
+	if (settings.get("DRESS_BLIZZ_BUBBLE")) then
+		local fontPath, _, fontFlags = ChatBubbleFont:GetFont();
+		ChatBubbleFont:SetFont(fontPath, settings.get("FONT_SIZE"), fontFlags);
+	end
 end

-
-
 function CommitChanges()
 	local restartRequired = (temporaryValue.FONT_SIZE ~= nil and settings.FONT_SIZE ~= temporaryValue.FONT_SIZE) or
 	           (temporaryValue.DRESS_BLIZZ_BUBBLE ~= nil and settings.DRESS_BLIZZ_BUBBLE ~= temporaryValue.DRESS_BLIZZ_BUBBLE);

-
 	for key, value in pairs(temporaryValue) do
 		settings[key] = value;
 	end
@@ -91,7 +92,7 @@ function RegisterFontSize(category)
 	local defaultValue = settings.get("FONT_SIZE");
 	local minValue = 8;
 	local maxValue = 128;
-	local step = 2;
+	local step = 1;

 	local setting = Settings.RegisterAddOnSetting(category, name, variable, type(defaultValue), defaultValue);
 	setting:SetCommitFlags(Settings.CommitFlag.Apply);