LoadFont question

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

LoadFont question

Post 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

help file:
If another font was previously loaded with the same #Font number, then the previous font is automatically freed.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Hehe, can't believe I missed that! :oops:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

BTW, it's the same for every PB objects (image, window etc.).
Post Reply