Difference between revisions of "love.graphics.setFont"

Line 46: Line 46:
 
* [[love.graphics.getFont]]
 
* [[love.graphics.getFont]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Set an already-loaded Font as the current font.
+
{{#set:Description=Set an already-loaded Font as the current font.}}
}}
+
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.graphics.setFont}}
 
{{i18n|love.graphics.setFont}}

Revision as of 10:20, 25 March 2011

Set an already-loaded Font as the current font.

This function doesn't allocate a new font and can be used in love.draw

Function

Synopsis

love.graphics.setFont( font )

Arguments

Font font
The Font object to use.

Returns

Nothing.

Function

Synopsis

love.graphics.setFont( filename, size )

Arguments

string filename
The filepath to the font.
number size (12)
The size of the font.

Returns

Nothing.

Function

This variant creates a new font using the default font and the size specified, and sets it as the current font. Do not use this function in love.update or love.draw. That would create a new font every frame, eating up memory very quickly.

Synopsis

love.graphics.setFont( size )

Arguments

number size (12)
The size of the font.

Returns

Nothing.

Examples

Draw some text with default font, 18px

love.graphics.setFont(18)

function love.draw()
	love.graphics.print("Hello", 300, 300)
end

See Also


Other Languages