From c446503828ef872810a50b1aa5ad524a9267daf6 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Mon, 27 Jul 2020 17:58:19 +0300 Subject: [PATCH] make font size limiting for SetFont --- WeakAuras/RegionTypes/Text.lua | 11 ++++++----- WeakAuras/SubRegionTypes/SubText.lua | 9 ++++----- WeakAurasOptions/RegionOptions/Text.lua | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 9c26f47..9b9a57f 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -77,10 +77,11 @@ local function modify(parent, region, data) region.useAuto = WeakAuras.CanHaveAuto(data); local fontPath = SharedMedia:Fetch("font", data.font); - text:SetFont(fontPath, data.fontSize, data.outline); + text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline); if not text:GetFont() then -- Font invalid, set the font but keep the setting - text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline); + text:SetFont(STANDARD_TEXT_FONT, data.fontSize <= 33 and data.fontSize or 33, data.outline); end + text:SetTextHeight(data.fontSize); if text:GetFont() then text:SetText("") text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(data.displayText)); @@ -96,7 +97,6 @@ local function modify(parent, region, data) region:SetWidth(region.width); region:SetHeight(region.height); - text:SetTextHeight(data.fontSize); text:SetShadowColor(unpack(data.shadowColor)) text:SetShadowOffset(data.shadowXOffset, data.shadowYOffset) @@ -246,7 +246,7 @@ local function modify(parent, region, data) function region:SetTextHeight(size) local fontPath = SharedMedia:Fetch("font", data.font); - region.text:SetFont(fontPath, size, data.outline); + region.text:SetFont(fontPath, size < 33 and size or 33, data.outline); region.text:SetTextHeight(size) end @@ -261,7 +261,8 @@ local function fallbackmodify(parent, region, data) WeakAuras.regionPrototype.modify(parent, region, data); local text = region.text; - text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline and "OUTLINE" or nil); + text:SetFont(STANDARD_TEXT_FONT, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil); + text:SetTextHeight(data.fontSize); if text:GetFont() then text:SetText(WeakAuras.L["Region type %s not supported"]:format(data.regionType)); end diff --git a/WeakAuras/SubRegionTypes/SubText.lua b/WeakAuras/SubRegionTypes/SubText.lua index ff016ad..80ae879 100644 --- a/WeakAuras/SubRegionTypes/SubText.lua +++ b/WeakAuras/SubRegionTypes/SubText.lua @@ -210,16 +210,15 @@ local function modify(parent, region, parentData, data, first) end local fontPath = SharedMedia:Fetch("font", data.text_font); - text:SetFont(fontPath, data.text_fontSize, data.text_fontType); + text:SetFont(fontPath, data.text_fontSize < 33 and data.text_fontSize or 33, data.text_fontType); if not text:GetFont() then -- Font invalid, set the font but keep the setting - text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize, data.text_fontType); + text:SetFont(STANDARD_TEXT_FONT, data.text_fontSize < 33 and data.text_fontSize or 33, data.text_fontType); end + text:SetTextHeight(data.text_fontSize); if text:GetFont() then text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(data.text_text)); end - text:SetTextHeight(data.text_fontSize); - text:SetShadowColor(unpack(data.text_shadowColor)) text:SetShadowOffset(data.text_shadowXOffset, data.text_shadowYOffset) text:SetJustifyH(data.text_justify or "CENTER") @@ -358,7 +357,7 @@ local function modify(parent, region, parentData, data, first) function region:SetTextHeight(size) local fontPath = SharedMedia:Fetch("font", data.text_font); - region.text:SetFont(fontPath, size, data.text_fontType); + region.text:SetFont(fontPath, size < 33 and size or 33, data.text_fontType); region.text:SetTextHeight(size) region:UpdateAnchorOnTextChange(); end diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index 3991950..f5b197d 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -320,7 +320,7 @@ local function modifyThumbnail(parent, borderframe, data, fullModify, size) size = size or 28; local fontPath = SharedMedia:Fetch("font", data.font) or data.font; - text:SetFont(fontPath, data.fontSize, data.outline and "OUTLINE" or nil); + text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil); text:SetTextHeight(data.fontSize); text:SetText(data.displayText); text:SetTextColor(data.color[1], data.color[2], data.color[3], data.color[4]);