Jump to content

Recommended Posts

Posted

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.

Posted

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.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...