# NNS_G2dTextCanvasDrawTextRect

## Syntax

      #include <nnsys/g2d/g2d_TextCanvas.h>

      void NNSi_G2dDrawTextRect(
      	const NNSG2dTextCanvas* pTxn,
      	int x,
      	int y,
      	int w,
      	int h,
      	int cl,
      	u32 flags,
      	const NNSG2dChar* txt
      );

## Arguments

pTxn | [IN] Pointer to TextCanvas
x | [IN] Coordinate (in CharCanvas coordinate system) of upper-left corner of rectangle that will serve as region for drawing
y | [IN] Coordinate (in CharCanvas coordinate system) of upper-left corner of rectangle that will serve as region for drawing
w | [IN] Width (in pixels) of rectangle that will serve as region for drawing
h | [IN] Height (in pixels) of rectangle that will serve as region for drawing
cl | [IN] Standard color No. to use for text-string drawing
flags | [IN] Drawing flags
txt | [IN] Pointer to text string

## Return Values

None.

## Description

Draws a text string using a rectangle shape for reference. If the text string includes '\n' (0x0A), the string is drawn with a line feed at that location. The rectangle is only used as a reference for determining the position of the text string. Clipping is not performed.

flags can be specified with any combination of these flags:

Horizontal Alignment

NNS_G2D_HORIZONTALALIGN_LEFT | Draws text string aligned to left inside rectangle.
NNS_G2D_HORIZONTALALIGN_CENTER | Draws text string aligned to middle of rectangle.
NNS_G2D_HORIZONTALALIGN_RIGHT | Draws text string aligned to right inside rectangle.

Vertical Alignment

NNS_G2D_VERTICALALIGN_TOP | Draws text string aligned to top of rectangle.
NNS_G2D_VERTICALALIGN_MIDDLE | Draws text string aligned to middle of rectangle.
NNS_G2D_VERTICALALIGN_BOTTOM | Draws text string aligned to bottom of rectangle.

The horizontal and the vertical alignments are swapped for the vertically written fonts.

## See Also

`NNS_G2dTextCanvasDrawText`

## Revision History

2007/03/14 Added support for vertically written/vertically held fonts.
2005/05/25 Initial version.

CONFIDENTIAL