A question to the Purebasic Team
A question to the Purebasic Team
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
> 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:
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.
"PureBasic won't be object oriented, period" - Fred.
-
- Enthusiast
- Posts: 152
- Joined: Sun Jul 11, 2004 7:48 pm
- Location: Lillehammer, No(r)way
- Contact:
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
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 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
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
-
- Enthusiast
- Posts: 152
- Joined: Sun Jul 11, 2004 7:48 pm
- Location: Lillehammer, No(r)way
- Contact:
@Freak: I ,and I suppose nessie, understand this...
BUT this doesn't seem to work with DrawText()..!
See example: viewtopic.php?t=13304
BUT this doesn't seem to work with DrawText()..!
See example: viewtopic.php?t=13304