##### Views

- Page
- Discussion
- View source
- History

# love.graphics.setFont

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.

## Function

### Synopsis

love.graphics.setFont( font )

### Arguments

`Font font`
  The Font object to use.

### Returns

Nothing.

## Function

Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.

### 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

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.

### Synopsis

love.graphics.setFont( size )

### Arguments

`number size (12)`
  The size of the font.

### Returns

Nothing.

## Examples

### Draw some text with default font, 18px

function love.graphics.load()
love.graphics.setFont(love.graphics.newFont(18))
end
function love.draw()
love.graphics.print("Hello", 300, 300)
end

## See Also

- love.graphics
- love.graphics.newFont
- love.graphics.getFont

## Other Languages

Dansk – Deutsch – English – Español – Français – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Polski – Português – Română – Slovenský – Suomi – Svenska – Türkçe – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – ไทย – 日本語 – 正體中文 – 简体中文 – Tiếng Việt – 한국어
More info

Retrieved from "https://www.love2d.org/wiki/love.graphics.setFont"
Categories: Templates | Functions

##### Personal tools

- Log in

##### Search

##### Toolbox

- What links here
- Related changes
- Special pages
- Printable version
- Permanent link
- Browse properties