Page 1 of 1

Fixed Font for LINUX Program

Posted: Sat May 27, 2006 9:01 pm
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?

Posted: Sat May 27, 2006 11:41 pm
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

Posted: Wed May 31, 2006 9:59 pm
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.

Posted: Wed May 31, 2006 10:09 pm
by ts-soft
MessageRequester allways use SystemFont. Is not a Gadget, is a SystemDialog

#False = 0
#True = <> 0

141131488 ist #True :wink:

Posted: Wed May 31, 2006 10:20 pm
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??

Posted: Wed Jul 26, 2006 9:08 pm
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.

Posted: Thu Jul 27, 2006 10:15 am
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...

Posted: Thu Jul 27, 2006 2:43 pm
by J. Baker
Thanks walker! ;)

Posted: Thu Jul 27, 2006 7:45 pm
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.

Posted: Thu Jul 27, 2006 8:19 pm
by J. Baker
No problem Beach! :wink: