Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need Help on Font Size of Numbers In Variable
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
s33nw33n




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Tue Jun 13, 2006 8:16 pm   Post subject: (No 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)
Cervantes




PostPosted: Tue Jun 13, 2006 8:16 pm   Post subject: (No 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
s33nw33n




PostPosted: Tue Jun 13, 2006 8:30 pm   Post subject: (No 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
Clayton




PostPosted: Tue Jun 13, 2006 8:51 pm   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: