Computer Science Canada

Need Help on Font Size of Numbers In Variable

Author:  s33nw33n [ Tue Jun 13, 2006 8:02 pm ]
Post subject:  Need Help on Font Size of Numbers In Variable

Hi.
First off, I have read the beginning of this thread : http://www.compsci.ca/v2/viewtopic.php?t=52&highlight=turing+numbers+font

However, when I use the Font.Draw, I can only use that for text. What If I want to change the font size of a number which is stored in a integer variable (firstnumber) ?

Thanks.

Author:  Clayton [ Tue Jun 13, 2006 8:16 pm ]
Post subject: 

change the int to a string and concatenate it into the string eg.

code:

var mySize:int:=20
var font:int:=Font.New("times new roman:"+intstr(mySize)+":bold")
Font.Draw("This works :)",0,0,font,red)

Author:  Cervantes [ Tue Jun 13, 2006 8:16 pm ]
Post subject: 

Since the font size is characteristic of the font itself, you'd have to create a whole bunch of fonts.

code:

var fonts : array 1 .. 5 of int
for i : 1 .. upper (fonts)
    fonts (i) := Font.new ("Times New Roman:" + intstr (i + 10))
end for

Author:  s33nw33n [ Tue Jun 13, 2006 8:30 pm ]
Post subject: 

SuperFreak82 wrote:
change the int to a string and concatenate it into the string eg.

code:

var mySize:int:=20
var font:int:=Font.New("times new roman:"+intstr(mySize)+":bold")
Font.Draw("This works :)",0,0,font,red)


Well, I was hoping that I would be able to do it without changing it into a string as I will use multiple numbers and use those numbers to add stuff etc. however, I guess I will just have to use multiple integers and strings now.
Thanks

Author:  Clayton [ Tue Jun 13, 2006 8:51 pm ]
Post subject: 

intstr only changes the int in question into a string in that instance, it then reverts back to an int after that line is complete, so you dont have to worry about changing the intstr'ed variable back to a string Very Happy


: