A question to the Purebasic Team

Linux specific forum
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

A question to the Purebasic Team

Post by nessie »

I'm curious. I am finding it impossible to change the font size using the command loadfont(). Can someone please advise me if there is an alternate way to change the font size as I really need some kind of answer to this. If I can't then I'll have to look at some other way to achieve this, but I'd like to know one way or the other please as I'm running short of time.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: A question to the Purebasic Team

Post by PB »

> I am finding it impossible to change the font size using the command loadfont()

What's wrong with its YSize parameter? Works fine for me:

Code: Select all

If OpenWindow(1,300,250,400,200,#PB_Window_SystemMenu,"test")
  CreateGadgetList(WindowID())
  TextGadget(0,0,0,300,150,"hi!") : FontSize=136 ; Big text!
  MyFont=LoadFont(0,"Courier New",FontSize) : SetGadgetFont(0,MyFont)
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

You do this in Linux??
Freak said in another post here that LoadFont() in Linux ignores the
FontStyle & FontName(?)..(I think he ment FontSize)..
Here: viewtopic.php?t=13304&start=15
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> You do this in Linux??

Oops, I didn't notice this was the Linux section of the forums. Sorry! :oops:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

PB Linux uses X font names. In such names, all information about style and
size is put into the name string itself. That is why the extra size parameter
is ignored there.

Have a look here at how such names are composed:
http://www.dsl.org/cookbook/cookbook_20.html#SEC313

You can simply play around with this by creating a little test app.
Just call FontRequester() and display the result of SelectedFontName()
in the console.

There you can see what the string looks like for any font and parameters
you just selected. If a field in the font string is an * it means that anything
can be there.
If your program will not allow the user to select the font himself (or as a
default font to your program) it is generally a good thing to put as much
* in the string as possible and only providing important aspects like
size and font family. Like this, the user will still be able to have a similar
look, even if he doesn't have the exact same font installed.

Hope this helps...

Timo
quidquid Latine dictum sit altum videtur
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

@Freak: I ,and I suppose nessie, understand this...
BUT this doesn't seem to work with DrawText()..!

See example: viewtopic.php?t=13304
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

It might be a bug then.
Sorry, but i cannot get to my linux development machine until monday night.
Maybe Fred can have a look earlier...

Timo
quidquid Latine dictum sit altum videtur
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

If he could that would be great. As i said in other post, I can work on another part of my app in the hope an update will be issued. Here's hoping :roll:
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I will take a look.
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

I see that with the new release of PB for Linux, the problem with loadfont() still exists. Can someone please :cry: advise me of a way to change the font and fontsize as I really am stuck on this. (Please)
Post Reply