Set an already-loaded Font as the current font or create and load a new one from the file and size.
It's recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage.
love.graphics.setFont( font )
Font font
Nothing.
Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.
love.graphics.setFont( filename, size )
Nothing.
Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.
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.
love.graphics.setFont( size )
number size (12)
Nothing.
function love.graphics.load() love.graphics.setFont(love.graphics.newFont(18)) end function love.draw() love.graphics.print("Hello", 300, 300) end
function love.load() Font = love.graphics.newFont("font.ttf", 18) end function love.draw() love.graphics.setFont(Font) love.graphics.print("Hello World", 0, 0) end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.setFont