Page 1 of 1

Font Sans, size, Hyperlink gadget

Posted: Thu Feb 16, 2006 12:32 pm
by rotacak
How load "Sans" font with specified size? All text in my app is too big. Also some special characters is broken, because is not used Sans font.
I use Ubuntu and font requester display only some fonts without "Sans". But in system setup "Sans" exist and is used.

Hyperlink gadget - when I click on adress, nothing happens. It's normal?

Posted: Thu Feb 16, 2006 3:15 pm
by Trond
You need to manually handle the click event on the hyperlink gadget.

Posted: Fri Feb 17, 2006 3:27 am
by rotacak
OK, but RunProgram("http://site.com") nothing do. In windows it's ok.

Posted: Fri Feb 17, 2006 5:20 pm
by Beach
rotacak wrote:OK, but RunProgram("http://site.com") nothing do. In windows it's ok.
On Linux, you are going to need to call a browser first. for example:

Gnome:

Code: Select all

RunProgram("nautilus","http://www.purebasic.com")
KDE:

Code: Select all

RunProgram("konqueror","http://www.purebasic.com")
You could do this with Firefox but not everyone one has it installed.

Posted: Sat Feb 18, 2006 2:03 pm
by rotacak
Thanx, this work OK.

And what font size? How change font size in gadgets?

Posted: Sat Feb 18, 2006 5:29 pm
by Beach
rotacak wrote:Thanx, this work OK.

And what font size? How change font size in gadgets?
Here is an example of how I set them. I could not figure out how to make a font underlined for your hyperlink gadget though. Still looks link-like to me...

Code: Select all

#PB_Font_Bold = 1
#PB_Font_Italic = 2
#PB_Font_Bold_Italic = 3

SansFont = LoadFont(#PB_Any,"sans",13,#PB_Font_Bold)
ArialFont = LoadFont(#PB_Any,"arial",8,#PB_Font_Italic)
HyperFont = LoadFont(#PB_Any,"sans",8,#PB_Font_Bold_Italic)

If SansFont = #FALSE Or ArialFont = #FALSE Or HyperFont = #FALSE
   MessageRequester("Error","Could not load system font")
   End
EndIff

If OpenWindow(0,174,8,170,110,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Font Test")
  If CreateGadgetList(WindowID(0))
    TextGadget(1,10,10,150,25,"This text should be in Arial...") 
    UseFont(ArialFont)
    SetGadgetFont(1,FontID())
    ButtonGadget(2,10,40,150,30,"Button")
    UseFont(SansFont)
    SetGadgetFont(2,FontID())
    HyperLinkGadget(3,10,75,150,28,"www.PureBasic.com",RGB(0,0,255))
    UseFont(HyperFont)
    SetGadgetFont(3,FontID())
  EndIf
EndIf

Repeat : Until WaitWindowEvent() = #PB_EventCloseWindow
Image

Posted: Thu Mar 09, 2006 2:45 am
by rotacak
This not work. Can't load font. Your sample picture looks like from Ubuntu, but I don't know how this can be done.

I try other way, described somewhere here in forum. Load font like horrible name name-font-size-bla-bla.....
This on linux work ok, but no in GTK2 :(

Posted: Fri Mar 10, 2006 7:17 am
by Beach
rotacak wrote:This not work. Can't load font. Your sample picture looks like from Ubuntu, but I don't know how this can be done.

I try other way, described somewhere here in forum. Load font like horrible name name-font-size-bla-bla.....
This on linux work ok, but no in GTK2 :(
The sample above was compiled using Ubuntu 5.10 and with the GTK2 sub system. What distro are you using?