Jump to content

knowing used default font


beo6
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...