Difference between revisions of "gc:setFont"

From Inspired-Lua Wiki
Jump to navigation Jump to search
m
 
Line 8: Line 8:
  
 
==Syntax==
 
==Syntax==
gc:'''setFont'''(family, style, size)
+
gc:'''setFont'''(family, style, size)
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 23: Line 23:
  
 
== Example ==  
 
== Example ==  
<syntaxhighlight>previousFont = gc:setFont("serif","bi",12) -- sets the font to Serif, Bold & Italic, Size 12. It also sets the name of the previous font (the one used before this function) in the variable 'previousfont'</syntaxhighlight>
+
<syntaxhighlight>previousFont = gc:setFont("serif","bi",12) -- sets the font to Serif, Bold & Italic, Size 12. It also sets the name of the previous font (the one used before this function) in the variable 'previousFont'</syntaxhighlight>
  
 
<br />
 
<br />
 
[[Category:gc]]
 
[[Category:gc]]

Latest revision as of 18:15, 23 August 2011

setFont is a function that is part of gc.

Sets the font for drawing text and measuring text size.

When you call this function, a string containing the previously used font is also returned. (See example)


This has been introduced in TI-Nspire OS 3.0 (Changes).


Syntax

gc:setFont(family, style, size)

Parameter Type Description
family
string the font's name : "serif" or "sansserif"
style
string "r" for regular, "i" for italic, "b" for bold, "bi" for bold & italic
size
number a number (decimals are OK) from 6 to 255

Example

previousFont = gc:setFont("serif","bi",12) -- sets the font to Serif, Bold & Italic, Size 12. It also sets the name of the previous font (the one used before this function) in the variable 'previousFont'