IdeasVacuum wrote:... A constant can be used for Font ID, but it must be unique, it cannot be the same constant used for a Gadget ID - that is the fault in the code.
This is an incorrect statement.
Look at this code, both Gadgets and Fonts have a unique constant yet the Gadget shares the same value as the Font.
Code: Select all
OpenWindow(0,0,0,200,100,"Work Form1",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(1,10,10,100,20,"Hello")
LoadFont(1,"Arial",12,#PB_Font_Bold)
SetGadgetFont(1,FontID(1))
TextGadget(2,10,30,100,20,"Hello")
LoadFont(2,"Arial",12,#PB_Font_Italic)
SetGadgetFont(2,FontID(2))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
The same code can be written as...
Code: Select all
#Constant1=1
#Constant2=2
OpenWindow(0,0,0,200,100,"Work Form1",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(#Constant1,10,10,100,20,"Hello")
SetGadgetFont(#Constant1,LoadFont(#Constant1,"Arial",12,#PB_Font_Bold))
TextGadget(#Constant2,10,30,100,20,"Hello")
SetGadgetFont(#Constant2,LoadFont(#Constant2,"Arial",12,#PB_Font_Italic))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Maybe his code snippet seemed wrong because it is out of context, you do not see the code in it's entirety.
You do not want to have duplicate Gadget constants or duplicate Font constants but a Gadget can certainly have the same constant value as a Font.
As for the "Times New Roman" font not showing in Linux, I experience the same issue as dibor when testing on Linux Mint 19 with the code FontRequester code he posted.
The font Previews fine when using the FontRequester but does not display as "Times New Roman" in the Text Gadget. (it subs it with Arial or similar)