Difference between revisions of "love.graphics.newFont"

m
Line 1: Line 1:
Creates a new [[Font]]. Make sure not to call this in [[love.draw]] or [[love.update]], as that would create a new font every frame; instead, call it once and save the font for future use, as in the examples below.
+
Creates a new [[Font]].
 +
{{newobjectnotice}}
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Revision as of 18:23, 27 January 2012

Creates a new Font.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



Function

Synopsis

font = love.graphics.newFont( filename, size )

Arguments

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

Returns

Font font
A Font object which can be used to draw text on screen.

Function

This variant uses the default font (Vera Sans) with a custom size.

Synopsis

font = love.graphics.newFont( size )

Arguments

number size (12)
The size of the font in pixels.

Returns

Font font
A Font object which can be used to draw text on screen.

See Also


Other Languages