# NNS_G2dTextCanvasDrawText

## Syntax

      #include <nnsys/g2d/g2d_TextCanvas.h>

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

## Arguments

pTxn | [IN] Pointer to TextCanvas
x | [IN] Coordinate of reference point (in CharCanvas coordinate system) for text-string drawing
y | [IN] Coordinate of reference point (in CharCanvas coordinate system) for text-string 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, with the reference point for drawing defined by (x, y). If the text string includes '\n' (0x0A), the string is drawn with a line feed at that location.

flags can be specified with any combination of these flags:

Horizontal Reference-Point Placement

NNS_G2D_HORIZONTALORIGIN_LEFT | Use the left end of the text string as the reference point for drawing.
NNS_G2D_HORIZONTALORIGIN_CENTER | Use the middle of the text string as the reference point for drawing.
NNS_G2D_HORIZONTALORIGIN_RIGHT | Use the right end of the text string as the reference point for drawing.

Vertical Reference-Point Placement

NNS_G2D_VERTICALORIGIN_TOP | Use the top of the text string as the reference point for drawing.
NNS_G2D_VERTICALORIGIN_MIDDLE | Use the middle of the text string as the reference point for drawing.
NNS_G2D_VERTICALORIGIN_BOTTOM | Use the bottom of the text string as the reference point for drawing.

Horizontal Alignment

NNS_G2D_HORIZONTALALIGN_LEFT | When text string comprises multiple lines, draw with all lines aligned left.
NNS_G2D_HORIZONTALALIGN_CENTER | When text string comprises multiple lines, draw with all lines centered.
NNS_G2D_HORIZONTALALIGN_RIGHT | When text string comprises multiple lines, draw with all lines aligned right.

Horizontal and vertical are swapped for vertically written fonts.

## See Also

`NNS_G2dTextCanvasDrawTextRect`

## Revision History

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

CONFIDENTIAL