Fixed Font for LINUX Program

Linux specific forum
heinz.goldbach
User
User
Posts: 25
Joined: Mon Dec 12, 2005 8:35 pm
Location: Neuss - Germany

Fixed Font for LINUX Program

Post by heinz.goldbach »

Hello,
i need a little help.
I want to use a fixed Font for a LINUX Program.
Because the "Multiline" isn´t possible for Linux, it is necessary to use a fixed Font to get
good fixed outputs.

In Windows i use for example:

Code: Select all

If LoadFont(10,"courier",16)
      SetGadgetFont(#PB_Default,FontID())   
EndIf
This shows in LINUX no effects.
It is only possible to change the size of the font in Text or Button Gadgets but not the font itself.

Now my Questions:
1. What is to do, to change the Font.
2. Is it possible to "include" a font into the Program like IncludeBinary?
Intel i3, 8 GB RAM, 2*200 GB HDD, Windows 7 64bit
SUSE LINUX 10.1
Mac G4, OSX 10.4.11, 80 GB HDD, 1,5 GB RAM
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

Please try it this way:

Code: Select all

MonoFont = LoadFont(#PB_Any,"monospace",10)

If MonoFont = #False 
  MessageRequester("Error","Could not load system font")
EndIf

  
If OpenWindow(0,174,8,250,100,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Font Test")
  If CreateGadgetList(WindowID(0))
    TextGadget(1,10,10,240,25,"This text is mono spaced...")
    UseFont(MonoFont)
    SetGadgetFont(1,FontID())
  EndIf
EndIf

Repeat : Until WaitWindowEvent() = #PB_EventCloseWindow
-Beach
heinz.goldbach
User
User
Posts: 25
Joined: Mon Dec 12, 2005 8:35 pm
Location: Neuss - Germany

Post by heinz.goldbach »

Thank you,
i have test it first today ( a new LINUX installation was necessary).
It works with a little problem.
The Text in the MessageRequester and in Frame3DGadget shows no effect.
It is always the Standard LINUX Font.
I work with the gtk2. Maybe that is the Problem.

And there is another interesting thing.
When you wrote:

Code: Select all

MonoFont = LoadFont(#PB_Any,"monospace",10) 
If MonoFont = #False
  MessageRequester("Error","Could not load system font")
EndIf 
You never get #False or #True.
The debugger shows for example 141131488.
Possible a "Distrubition Problem" (SUSE 9.3).
With 4.0 everything, i hope, get better.
Intel i3, 8 GB RAM, 2*200 GB HDD, Windows 7 64bit
SUSE LINUX 10.1
Mac G4, OSX 10.4.11, 80 GB HDD, 1,5 GB RAM
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

MessageRequester allways use SystemFont. Is not a Gadget, is a SystemDialog

#False = 0
#True = <> 0

141131488 ist #True :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
heinz.goldbach
User
User
Posts: 25
Joined: Mon Dec 12, 2005 8:35 pm
Location: Neuss - Germany

Post by heinz.goldbach »

Hello ts-soft

When i wrote:

Code: Select all

MonoFont = LoadFont(#PB_Any,"FIFA2006",10)
If MonoFont = #False
  MessageRequester("Error","Could not load system font")
EndIf 
or

Code: Select all

MonoFont = LoadFont(#PB_Any,"FIFA2006",10)
If MonoFont = #True
  MessageRequester("Error","Could not load system font")
EndIf 
the MessageRequester doesn´t shown.
I don´t know why??
Intel i3, 8 GB RAM, 2*200 GB HDD, Windows 7 64bit
SUSE LINUX 10.1
Mac G4, OSX 10.4.11, 80 GB HDD, 1,5 GB RAM
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Hey Beach, have you tried loading fonts in the latest Ubuntu (v6.06)? I can't seem to get it to work.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi,

I think, you can use a fontname like "monospace" only, when compiling with gtk2 as subsystem... otherwise you have to use this format:
-bitstream-charter-medium-r-normal-*-*-120-*-*-p-*-iso8859-1 Which is the old gtk-format for a fontname...
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Thanks walker! ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

Sorry J.. I'm out of town and my server I normally VNC into when I am away from home now has Xgl/Compiz on it.
-Beach
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

No problem Beach! :wink:
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply