Creates a new Font. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object.
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!
font = love.graphics.newFont( filename, size )
Font fontfont = love.graphics.newFont( data, size )
Font fontThis variant uses the default font (Vera Sans) with a custom size.
font = love.graphics.newFont( size )
number size (12)Font font-- load ttf file font. set 20px font-size
mainFont = love.graphics.newFont("anyfont.ttf", 20);
function love.draw()
-- set font before draw text
love.graphics.setFont(mainFont);
-- draw text "Hello world!" at left: 100, top: 200
love.graphics.print("Hello world!", 100, 200);
end;
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.newFont