Page 1 of 1

LoadFont question

Posted: Sun Jan 01, 2006 7:39 am
by PB
In my app I've got a "font preview" thing happening, where the user can
click a font name in a ListIconGadget and the font is shown in a StringGadget.
Basically, I'm doing f=LoadFont(1,name$,size) every time the user clicks the
ListIconGadget, and then doing SetGadgetFont(#StringGadget,f) to show it.
My question is: is this safe to do? Like, will the new font replace the old one
because I'm loading it into font number 1 each time? Or should I be doing
CloseFont(1) before loading the new one? I've checked with the Task
Manager and my app's memory usage is steady and doesn't go beserk or
anything, so I assume what I'm doing is safe?

Posted: Sun Jan 01, 2006 10:01 am
by blueznl
help file:
If another font was previously loaded with the same #Font number, then the previous font is automatically freed.

Posted: Sun Jan 01, 2006 11:02 am
by PB
Hehe, can't believe I missed that! :oops:

Posted: Sun Jan 01, 2006 2:37 pm
by Fred
BTW, it's the same for every PB objects (image, window etc.).