As already stated, you should be using SystemParametersInfo function
This is what I need. The window works as expected.
Code: Select all
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
#G_TYPE_STRING = 64
ImportC ""
g_object_get_property(*widget.GtkWidget, property.p-utf8, *gval)
EndImport
CompilerEndSelect
Procedure.S FontName( FontID )
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
Protected sysFont.LOGFONT
GetObject_(FontID, SizeOf(LOGFONT), @sysFont)
ProcedureReturn PeekS(@sysFont\lfFaceName[0])
CompilerCase #PB_OS_Linux
Protected gVal.GValue
Protected.s StdFnt
g_value_init_( @gval, #G_TYPE_STRING )
g_object_get_property( gtk_settings_get_default_(), "gtk-font-name", @gval )
StdFnt = PeekS( g_value_get_string_( @gval ), -1, #PB_UTF8 )
g_value_unset_( @gval )
ProcedureReturn StdFnt
CompilerEndSelect
EndProcedure
Procedure FontSize( FontID )
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
Protected sysFont.LOGFONT
GetObject_(FontID, SizeOf(LOGFONT), @sysFont)
ProcedureReturn MulDiv_(-sysFont\lfHeight, 72, GetDeviceCaps_(GetDC_(#NUL), #LOGPIXELSY))
CompilerCase #PB_OS_Linux
Protected gVal.GValue
Protected.s StdFnt
g_value_init_(@gval, #G_TYPE_STRING)
g_object_get_property( gtk_settings_get_default_(), "gtk-font-name", @gval)
StdFnt= PeekS(g_value_get_string_(@gval), -1, #PB_UTF8)
g_value_unset_(@gval)
ProcedureReturn Val(StringField((StdFnt), 2, " "))
CompilerEndSelect
EndProcedure
OpenWindow(1,100,100,450,420,"Test",#PB_Window_SystemMenu)
LoadFont(1,"Monaco",13)
SetGadgetFont(#PB_Default,FontID(1))
TextGadget(1,20,10,800,50,"default font monaco for all gadgets")
Debug "font from all gadgets default "
Debug FontName( GetGadgetFont(#PB_Default) )
Debug FontSize( GetGadgetFont(#PB_Default) )
LoadFont(2,"Courier New",21)
TextGadget(10,20,300,800,50,"font requiring pixels")
SetGadgetFont(10,FontID(2))
Debug ""
Debug "font from gadget 10 "
Debug FontName( GetGadgetFont(10) )
Debug FontSize( GetGadgetFont(10) )
LoadFont(3,"Arial",35)
TextGadget(11,20,350,800,50,"font requiring pixels")
SetGadgetFont(11,FontID(3))
Debug ""
Debug "font from gadget 11 "
Debug FontName( GetGadgetFont(11) )
Debug FontSize( GetGadgetFont(11) )
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow