From 500d36240a0a992cf8f101ecf0c83736562acdc7 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:23:22 +0300 Subject: [PATCH 1/7] Limit max amount of fonts that player can use --- lua/entities/gmod_wire_textscreen.lua | 13 +++++++++++-- lua/wire/server/wirelib.lua | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_textscreen.lua b/lua/entities/gmod_wire_textscreen.lua index ae410711bc..8b577a4c08 100644 --- a/lua/entities/gmod_wire_textscreen.lua +++ b/lua/entities/gmod_wire_textscreen.lua @@ -275,9 +275,18 @@ end function ENT:SendConfig(ply) self.doSendConfig = false + + local font = string.sub(self.tfont, 0, 31) + local size = self.chrPerLine + + if not WireLib.CheckFont(font .. size, self:GetPlayer()) then + font = "Arial" + size = 10 + end + WireLib.netStart(self) net.WriteBit(true) -- Sending Config - net.WriteUInt(self.chrPerLine, 4) + net.WriteUInt(size, 4) net.WriteUInt(self.textJust, 2) net.WriteUInt(self.valign, 2) @@ -288,7 +297,7 @@ function ENT:SendConfig(ply) net.WriteUInt(self.bgcolor.r, 8) net.WriteUInt(self.bgcolor.g, 8) net.WriteUInt(self.bgcolor.b, 8) - net.WriteString(string.sub(self.tfont,0,31)) + net.WriteString(font) WireLib.netEnd(ply) end diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index bc54fb0b12..f99ee76164 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1641,6 +1641,27 @@ function WireLib.SoundExists(path, ply) return path end +local uniqueFontsTbl = setmetatable({}, {__index=function(t,k) local r={[1]=0} t[k]=r return r end}) +local maxUniqueFonts = CreateConVar("wire_fonts_unique_max", "200", FCVAR_ARCHIVE, "The maximum number of fonds a player is allowed to create", 0) + +function WireLib.CheckFont(font, ply) + if ply then + -- A player can only create a certain number of fonts + local playerFonts = uniqueFontsTbl[ply:SteamID()] + + if not playerFonts[font] then + if playerFonts[1] >= maxUniqueFonts:GetInt() then + return + end + + playerFonts[font] = true + playerFonts[1] = playerFonts[1] + 1 + end + end + + return font +end + -- Notify -- local triv_start = WireLib.Net.Trivial.Start From 1254e1903e8a3c7b68661ff6e2503f1769a7cbcf Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:27:07 +0300 Subject: [PATCH 2/7] Lower default --- lua/wire/server/wirelib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index f99ee76164..081eef6e2f 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1642,7 +1642,7 @@ function WireLib.SoundExists(path, ply) end local uniqueFontsTbl = setmetatable({}, {__index=function(t,k) local r={[1]=0} t[k]=r return r end}) -local maxUniqueFonts = CreateConVar("wire_fonts_unique_max", "200", FCVAR_ARCHIVE, "The maximum number of fonds a player is allowed to create", 0) +local maxUniqueFonts = CreateConVar("wire_fonts_unique_max", "50", FCVAR_ARCHIVE, "The maximum number of fonds a player is allowed to create", 0) function WireLib.CheckFont(font, ply) if ply then From b1dcbfadff0475709e021094495223970c5b51c6 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:29:41 +0300 Subject: [PATCH 3/7] Fix typo --- lua/wire/server/wirelib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index 081eef6e2f..b3c09aa3f3 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1642,7 +1642,7 @@ function WireLib.SoundExists(path, ply) end local uniqueFontsTbl = setmetatable({}, {__index=function(t,k) local r={[1]=0} t[k]=r return r end}) -local maxUniqueFonts = CreateConVar("wire_fonts_unique_max", "50", FCVAR_ARCHIVE, "The maximum number of fonds a player is allowed to create", 0) +local maxUniqueFonts = CreateConVar("wire_fonts_unique_max", "50", FCVAR_ARCHIVE, "The maximum number of fonts a player is allowed to create", 0) function WireLib.CheckFont(font, ply) if ply then From ad3cf33b494209d54396b635754213377dc1a0be Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:42:29 +0300 Subject: [PATCH 4/7] Use WireLib.CanFont --- .../gmod_wire_expression2/core/egpfunctions.lua | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua index 4d3ebb59f0..d466df3350 100644 --- a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua @@ -255,20 +255,7 @@ end -- Font ---------------------------- local function canCreateFont( ply, font, size ) - size = size or 18 - - EGP.PlayerFontCount[ply:SteamID64()] = EGP.PlayerFontCount[ply:SteamID64()] or { fonts = {}, count = 0 } - local fontTable = EGP.PlayerFontCount[ply:SteamID64()] - - if fontTable.count >= 50 then return false end - - local fontName = font .. size - if fontTable.fonts[fontName] then return true end - - fontTable.count = fontTable.count + 1 - fontTable.fonts[fontName] = true - - return true + return WireLib.CanFont(font .. (size or 18), ply) end e2function void wirelink:egpFont( number index, string font ) From 40822bef516e2709c872eaeddca249735ffb4659 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:46:25 +0300 Subject: [PATCH 5/7] Use actual font size instead of chrPerLine --- lua/entities/gmod_wire_textscreen.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_textscreen.lua b/lua/entities/gmod_wire_textscreen.lua index 8b577a4c08..33de569bc2 100644 --- a/lua/entities/gmod_wire_textscreen.lua +++ b/lua/entities/gmod_wire_textscreen.lua @@ -277,9 +277,9 @@ function ENT:SendConfig(ply) self.doSendConfig = false local font = string.sub(self.tfont, 0, 31) - local size = self.chrPerLine + local size = 760 / self.chrPerLine - if not WireLib.CheckFont(font .. size, self:GetPlayer()) then + if not WireLib.CheckFont(font .. math.floor(760 / size), self:GetPlayer()) then font = "Arial" size = 10 end From 301601a72aecc18e9940c2e7267e6fe92e2367f7 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:47:58 +0300 Subject: [PATCH 6/7] Don't divide twice --- lua/entities/gmod_wire_textscreen.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_textscreen.lua b/lua/entities/gmod_wire_textscreen.lua index 33de569bc2..779eff725d 100644 --- a/lua/entities/gmod_wire_textscreen.lua +++ b/lua/entities/gmod_wire_textscreen.lua @@ -277,7 +277,7 @@ function ENT:SendConfig(ply) self.doSendConfig = false local font = string.sub(self.tfont, 0, 31) - local size = 760 / self.chrPerLine + local size = self.chrPerLine if not WireLib.CheckFont(font .. math.floor(760 / size), self:GetPlayer()) then font = "Arial" From 0d756d15c732f38c35367fff0062d4021990e44f Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 19 Sep 2026 23:52:26 +0300 Subject: [PATCH 7/7] Remove dead code --- lua/entities/gmod_wire_egp/lib/egplib/materials.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/entities/gmod_wire_egp/lib/egplib/materials.lua b/lua/entities/gmod_wire_egp/lib/egplib/materials.lua index 78158986ed..d8b79923ae 100644 --- a/lua/entities/gmod_wire_egp/lib/egplib/materials.lua +++ b/lua/entities/gmod_wire_egp/lib/egplib/materials.lua @@ -3,10 +3,6 @@ -------------------------------------------------------- local EGP = EGP -if SERVER then - EGP.PlayerFontCount = EGP.PlayerFontCount or {} -end - if CLIENT then -- Valid fonts table EGP.ValidFonts_Lookup = EGP.ValidFonts_Lookup or {}