March 28, 2024, 04:27:17 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Default font

Started by Egil, November 24, 2010, 07:59:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

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
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Hi Egil,

setfont win,"", 0, 0

seems to restore the default OK ..

all the best, :)

Graham
Tomorrow may be too late ..

Egil

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
Support Amateur Radio  -  Have a ham  for dinner!

GWS

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


Tomorrow may be too late ..

Egil

Works same way on win7 and XP.

Regards,

Egil
Support Amateur Radio  -  Have a ham  for dinner!