1
0
mirror of https://github.com/Earu/EasyChat.git synced 2025-03-04 03:13:20 -05:00

Fix a markup bug serverside

This commit is contained in:
Earu 2021-12-23 11:12:21 +01:00
parent 15ec924361
commit 177311e118

View File

@ -614,10 +614,20 @@ function text_part:Draw(ctx)
ctx:CallPostTextDrawFunctions(x, y, self.Size.W, self.Size.H)
end
function text_part:IsTextWider(text, width)
surface_SetFont(self.Font)
local w, _ = surface_GetTextSize(text)
return w >= width
if CLIENT then
function text_part:IsTextWider(text, width)
surface_SetFont(self.Font)
local w, _ = surface_GetTextSize(text)
return w >= width
end
end
-- assume we're using the default font on server
if SERVER then
function text_part:IsTextWider(text, width)
local w, _ = #text * 16
return w >= width
end
end
local hard_break_treshold = 10