##### Views

- Page
- Discussion
- View source
- History

# love.graphics.printf

Draws formatted text, with word wrap and alignment.

See additional notes in love.graphics.print.

| Wrapping is implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words will end up missing when printed on the screen, and some lines can overflow past the limit you provide! |

| Aligning does not work as one might expect! It doesn't align to the x/y coordinates given, but in a rectangle, where the limit is the width. |

## Function

### Synopsis

love.graphics.printf( text, x, y, limit, align )

### Arguments

`string text`
  A text string.
`number x`
  The position on the x-axis.
`number y`
  The position on the y-axis.
`number limit`
  Wrap the line after this many horizontal pixels.
`AlignMode align ("left")`
  The alignment.

### Returns

Nothing.

## Function

Available since LÖVE 0.9.0
This variant is not supported in earlier versions.

### Synopsis

love.graphics.printf( text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky )

### Arguments

`string text`
  A text string.
`number x`
  The position on the x-axis.
`number y`
  The position on the y-axis.
`number limit`
  Wrap the line after this many horizontal pixels.
`AlignMode align ("left")`
  The alignment.
`number r (0)`
  Orientation (radians).
`number sx (1)`
  Scale factor (x-axis).
`number sy (sx)`
  Scale factor (y-axis).
`number ox (0)`
  Origin offset (x-axis).
`number oy (0)`
  Origin offset (y-axis).
`number kx (0)`
  Shearing factor (x-axis).
`number ky (0)`
  Shearing factor (y-axis).

### Returns

Nothing.

## Examples

Draw text to the screen with right alignment and a horizontal limit of 125.

love.graphics.printf("This text is aligned right, and wraps when it gets too big.", 25, 25, 125, "right")

## Notes

Note that the limit argument affects the position of your text for 'center' and 'right' alignment.

love.graphics.printf("This text is aligned center",100, 100, 200,"center") -- center your text around x = 200/2 + 100 = 200
love.graphics.printf("This text is aligned right",100, 100, 200,"right") -- align right to x = 100 + 200 = 300

## See Also

- love.graphics

## 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.printf"
Categories: Templates | Functions

##### Personal tools

- Log in

##### Search

##### Toolbox

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