IonicWind Software

Creative Basic => General Questions => Topic started by: Egil on November 24, 2010, 07:59:03 AM

Title: Default font
Post by: Egil on November 24, 2010, 07:59:03 AM
After defining a large font size for a subroutine, I needed to return to the default font.
I mean to have read that SETFONT win,"System",0,0 will revert you to the default font, after using another font for a while.
When tried, the statement seems to work perfectly with CB v.1.153 (Using that version to benefit from the serial component which doesn't work with other versions).

No reference to this has been found in the CB documentation, so I wonder if it is safe to use  SETFONT this way?

All the best.
Egil
Title: Re: Default font
Post by: GWS on November 24, 2010, 09:31:31 AM
Hi Egil,

setfont win,"", 0, 0

seems to restore the default OK ..

all the best, :)

Graham
Title: Re: Default font
Post by: Egil on November 24, 2010, 11:25:31 AM
Hi Graham,
this is very strange. Comparing "my" sefont statement with "yours" in a test setup, outputs two different font wheights. I wonder if this only occurs on my setup (Win7/64 - CB 1.153).
But, I can of course use setfont at the start of the program, and use the same statement when I have to "clean the board" after using other fonts and sizes.

Here is my test code:

' setfont_test.cba
AUTODEFINE "OFF"

DEF win:window
def run:int

WINDOW win,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"SETFONT Demo",main
drawmode win,@TRANSPARENT
setwindowcolor win, rgb(100,250,250)

move win,125,150
print win,"This is written without specifying any font."

SETFONT win, "Comic Sans MS", 24, 700, @SFITALIC
move win,100,200
Print win,"Creative Basic rules"

move win, 50,300

SETFONT win,"System",0,0
print win," Resetting to default font using my method",
SETFONT win,"",0,0
print win,"   and now using Graham's method"

run = 1
waituntil run = 0
closewindow win
end


SUB main
select @class
case @idclosewindow
run=0
case @IDCREATE
CenterWindow win
endselect
RETURN


All the best!

Egil
Title: Re: Default font
Post by: GWS on November 25, 2010, 01:20:28 AM
It looks as if your method ..

SETFONT win,"System",0,0

returns to the usual default font, which I think is Sans Serif (10pt Bold).  Larry M probably knows more about Windows fonts ..  :)

The shortcut, minimalist way I suggested ..

SETFONT win,"",0,0

seems to revert to the 'bare bones' Sans Serif (10pt regular).

So I suppose both would have their uses ..  ;D

Whether the results are consistent across all of Microsoft's OS's I don't know.

all the best, :)

Graham


Title: Re: Default font
Post by: Egil on November 25, 2010, 05:11:34 AM
Works same way on win7 and XP.

Regards,

Egil