beo6 Posted February 9, 2015 Share Posted February 9, 2015 I want to revert back to the default font after i have drawn a text on the screen. But using self.originalFont = context:GetFont() does not work unless context:SetFont(self.font) was at least called once before. But since the game draws texts by default already with probably the default font (Arial) i wonder why it does not return the default font. How is everyone else doing this? I don't want to set the font after my script is done drawing, guessing that the user is using the default font. Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 9, 2015 Share Posted February 9, 2015 After using GetFont() to obtain the default, add a reference for it. So the code would look like: self.originalFont = context:GetFont() self.originalFont:AddRef() This works for me, then you can load and set other fonts as needed. Granted I am still not clear why the GetFont() command does not automatically add a reference for itself but I am sure there is some grand reasoning behind some of the these decisions. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.