Page 1 of 1
Why can't I use Arial 8 bold?
Posted: Mon Dec 19, 2005 8:51 pm
by mike74
In Windows XP I'm trying to use the lines
Code: Select all
result = LoadFont(#PB_Any, "Arial", 8, #PB_Font_Bold)
SetGadgetFont(control_id, result)
and the resulting font appears to be System 10. I understand that Windows will try to find a matching font if the specified font is not found, but shouldn't it be able to find Arial 8 bold? Please help!
Posted: Mon Dec 19, 2005 9:02 pm
by Trond
Code: Select all
If OpenWindow(0,0,0,222,130,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"SetGadgetFont") And CreateGadgetList(WindowID(0))
ButtonGadget(0,10,10, 200, 30, "Button - Arial 8")
result = LoadFont(#PB_Any, "Arial", 8, #PB_Font_Bold)
SetGadgetFont(0, FontID()) ;<---------------
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Posted: Mon Dec 19, 2005 9:27 pm
by mike74
Thanks a lot, Trond. I wonder what the purpose is of having the value that is placed in result differ from the value of FontID() after the LoadFont instruction, unless it's because a FontID() equal to 0 would cause confusion because result = 0 means the font was not loaded...
Posted: Mon Dec 19, 2005 10:52 pm
by Paul
The return result is for use with the "Use" command...
Code: Select all
If OpenWindow(0,0,0,222,130,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"SetGadgetFont") And CreateGadgetList(WindowID(0))
ButtonGadget(0,10,10, 200, 30, "Button - Arial 8")
result = LoadFont(#PB_Any, "Arial", 8, #PB_Font_Bold)
SetGadgetFont(0, UseFont(result))
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Posted: Mon Dec 19, 2005 11:14 pm
by mike74
Paul wrote:The return result is for use with the "Use" command...
Code: Select all
If OpenWindow(0,0,0,222,130,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"SetGadgetFont") And CreateGadgetList(WindowID(0))
ButtonGadget(0,10,10, 200, 30, "Button - Arial 8")
result = LoadFont(#PB_Any, "Arial", 8, #PB_Font_Bold)
SetGadgetFont(0, UseFont(result))
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Ok, but it still seems that result could contain the same value as FontID() (and that value could be used in UseFont).