Page 1 of 1

A question to the Purebasic Team

Posted: Thu Dec 09, 2004 11:14 pm
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.

Re: A question to the Purebasic Team

Posted: Fri Dec 10, 2004 11:34 pm
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

Posted: Sat Dec 11, 2004 12:51 am
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

Posted: Sat Dec 11, 2004 5:08 am
by PB
> You do this in Linux??

Oops, I didn't notice this was the Linux section of the forums. Sorry! :oops:

Posted: Sat Dec 11, 2004 5:50 pm
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

Posted: Sat Dec 11, 2004 10:53 pm
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

Posted: Sun Dec 12, 2004 1:50 am
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

Posted: Sun Dec 12, 2004 10:26 am
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:

Posted: Wed Dec 15, 2004 10:29 am
by Fred
I will take a look.

Posted: Wed Dec 29, 2004 11:11 pm
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)