< index < 2. Console < 2.2 Drawing on the root console | ===================================== Printing a left aligned string with autowrap ===================================== |

    C++ : int TCODConsole::printLeftRect(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, const char *fmt, ...)
    C   : int TCOD_console_print_left_rect(TCOD_console_t con,int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, const char *fmt, ...)
    Py  : console_print_left_rect(con,x, y, w, h, flag, fmt)

This function draws a left aligned string in a rectangle inside the console, using default foreground and background colors. If the string reaches the right border of the rectangle, carriage returns are inserted.
If h > 0 and the bottom of the rectangle is reached, the string is truncated. If h = 0, the string is only truncated if it reaches the bottom of the console.
The function returns the height (number of console lines) of the printed string.

Parameter | Description
--- | ---
con | In the C version, the offscreen console handler or NULL for the root console.
x,y | Coordinates of the rectangle upper-left corner in the console. 0 <= x < console width 0 <= y < console height
w,h | Size of the rectangle in the console. x <= x+w < console width y <= y+h < console height
flag | This flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t.
fmt | printf-like format string, eventually followed by parameters. You can use control codes to change the colors inside the string.

You can also get the expected height without actually printing the string :

    C++ : int TCODConsole::getHeightLeftRect(int x, int y, int w, int h, const char *fmt, ...)
    C   : int TCOD_console_height_left_rect(TCOD_console_t con,int x, int y, int w, int h, const char *fmt, ...)
    Py  : console_height_left_rect(con,x, y, w, h, fmt)

Parameter | Description
--- | ---
con | In the C version, the offscreen console handler or NULL for the root console.
x,y | Coordinates of the rectangle's upper-left position in the console. 0 <= x < console width 0 <= y < console height
w,h | Size of the rectangle in the console. x <= x+w < console width y <= y+h < console height
fmt | printf-like format string, eventually followed by parameters. You can use control codes to change the colors inside the string.