I am done with a widget but I just noticed that if I disable it ingame and then enable it, the screem will freeze for 3-5 secs. After a lot if trial and error I came to the conclusion that this is due to loading four different fonts:
Code:
local gl, GL = gl, GL local header1FontSize = 20 local header1Font = gl.LoadFont("fonts/texgyreheros-bold.otf", header1FontSize, 45, 25) local header2FontSize = 20 local header2Font = gl.LoadFont("fonts/texgyreheros-bold.otf", header2FontSize) local header3FontSize = 20 local header3Font = gl.LoadFont("fonts/UnDotum.ttf", header3FontSize) local toolTipFontSize = 12 local toolTipFont = gl.LoadFont("fonts/UnDotum.ttf", toolTipFontSize, 12)
Ok so the problem seems to depend on the extra parameters given to LoadFont(). Taking off the outline parameters fixes this. For small outline numbers it lags less. The higher the number, the longer the game stays frozen.
Thus this will load instantly without any lag:
Code:
local gl, GL = gl, GL local header1FontSize = 20 local header1Font = gl.LoadFont("fonts/texgyreheros-bold.otf", header1FontSize) local header2FontSize = 20 local header2Font = gl.LoadFont("fonts/texgyreheros-bold.otf", header2FontSize) local header3FontSize = 20 local header3Font = gl.LoadFont("fonts/UnDotum.ttf", header3FontSize) local toolTipFontSize = 12 local toolTipFont = gl.LoadFont("fonts/UnDotum.ttf", toolTipFontSize)
Well one weird thing is that I don't see any optical difference with the parameters applied or not. The text always looks the same no matter if I give an outline of 50 or 2.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum