I asked this question in the beginners section but nobody replied. I really would like to know the answer.
The PB document states SetGadgetFont() is available in Linux, but none of the other accompanying functions are supported (LoadFont, UseFont).
How would I go about changing the gadget font?
Just let me know if it is even possible.
Change gadget font
Sorry for not answering yet.
The docs seem to be wrong here. LoadFont() is supported, and so is UseFone() afaik.
Only thing is that the 'size' and 'style' parameters of loadfont() are ignored,
because on linux you have to specify all that in the font name string.
Just run the FontRequester() and display the string it returns. This is what you
need to pass to loadfont to get the size & style you want.
Timo
The docs seem to be wrong here. LoadFont() is supported, and so is UseFone() afaik.
Only thing is that the 'size' and 'style' parameters of loadfont() are ignored,
because on linux you have to specify all that in the font name string.
Just run the FontRequester() and display the string it returns. This is what you
need to pass to loadfont to get the size & style you want.
Timo
quidquid Latine dictum sit altum videtur
Thanks so much Timo! That did the trick. There is one small issue, it seems that OptionGadgets do not change to the requested font as the other gadgets do. Is this normal?
Code: Select all
myfont$ = "-misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-koi8-r"
if LoadFont(#PB_Any,myfont$,0) = #FALSE
MessageRequester("Error","Could not load system font")
EndIf
If OpenWindow(0,174,8,170,100,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Test Fonts")
If CreateGadgetList(WindowID(0))
TextGadget(1,10,10,150,25,"This is a test!!")
SetGadgetFont(1,FontID())
ButtonGadget(2,10,40,150,25,"Button Text")
SetGadgetFont(2,FontID())
OptionGadget(3,10,70,150,25,"Option gadget")
SetGadgetFont(3,FontID())
EndIf
EndIf
Repeat : Until WaitWindowEvent() = #PB_EventCloseWindow