---
name: "al_draw_multiline_text"
section: "3"
platform: "linux"
package: "allegro"
version: "5.2.11.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/al_draw_multiline_text"
---

# al\_draw\_multiline\_text(3)

Allegro 5 API

## NAME

al\_draw\_multiline\_text - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro_font.h>
  void al_draw_multiline_text(const ALLEGRO_FONT *font,
       ALLEGRO_COLOR color, float x, float y, float max_width, float line_height,
       int flags, const char *text)
  ```

## DESCRIPTION

Like [al\_draw\_text(3)](/al_draw_text/3.md), but this function supports drawing multiple lines of text. It will break `text` in lines based on its contents and the `max_width` parameter. The lines are then layed out vertically depending on the `line_height` parameter and drawn each as if [al\_draw\_text(3)](/al_draw_text/3.md) was called on them.

A newline `\n` in the `text` will cause a “hard” line break after its occurrence in the string. The text after a hard break is placed on a new line. Carriage return `\r` is not supported, will not cause a line break, and will likely be drawn as a square or a space depending on the font.

The `max_width` parameter controls the maximum desired width of the lines. This function will try to introduce a “soft” line break after the longest possible series of words that will fit in `max_length` when drawn with the given `font`. A “soft” line break can occur either on a space or tab (`\t`) character.

However, it is possible that `max_width` is too small, or the words in `text` are too long to fit `max_width` when drawn with `font`. In that case, the word that is too wide will simply be drawn completely on a line by itself. If you don’t want the text that overflows `max_width` to be visible, then use [al\_set\_clipping\_rectangle(3)](/al_set_clipping_rectangle/3.md) to clip it off and hide it.

The lines `text` was split into will each be drawn using the `font`, `x`, `color` and `flags` parameters, vertically starting at `y` and with a distance of `line_height` between them. If `line_height` is zero (`0`), the value returned by calling [al\_get\_font\_line\_height(3)](/al_get_font_line_height/3.md) on `font` will be used as a default instead.

The `flags` ALLEGRO\_ALIGN\_LEFT, ALLEGRO\_ALIGN\_CENTRE, ALLEGRO\_ALIGN\_RIGHT and ALLEGRO\_ALIGN\_INTEGER will be honoured by this function.

If you want to calculate the size of what this function will draw without actually drawing it, or if you need a complex and/or custom layout, you can use [al\_do\_multiline\_text(3)](/al_do_multiline_text/3.md).

## SINCE

5\.1.9

## SEE ALSO

[al\_do\_multiline\_text(3)](/al_do_multiline_text/3.md), [al\_draw\_multiline\_ustr(3)](/al_draw_multiline_ustr/3.md), [al\_draw\_multiline\_textf(3)](/al_draw_multiline_textf/3.md)
