Why can't I use Arial 8 bold?

Windows specific forum
mike74
User
User
Posts: 60
Joined: Mon Nov 21, 2005 1:44 pm

Why can't I use Arial 8 bold?

Post 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!
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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
mike74
User
User
Posts: 60
Joined: Mon Nov 21, 2005 1:44 pm

Post 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...
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post 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
Image Image
mike74
User
User
Posts: 60
Joined: Mon Nov 21, 2005 1:44 pm

Post 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).
Post Reply