# NNS_G2dTextCanvasDrawString

## Syntax

      #include <nnsys/g2d/g2d_TextCanvas.h>

      void NNS_G2dTextCanvasDrawString(
      	const NNSG2dTextCanvas* pTxn,
      	int x,
      	int y,
      	int cl,
      	const NNSG2dChar* str,
      	const NNSG2dChar** pPos
      );

## 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
str | [IN] Text string to draw
pPos | [OUT] Pointer to buffer for getting the pointer to the start of the next line. (NULL can be specified)

## Return Values

None.

## Description

Draws one line's worth of text, with the point (x, y) defining the upper left corner of the first text character. Specifically, it draws a text string from str to '\n' (0x0A) or '\0'.

If pPos is a non-NULL value, when '\n' is included in text string str, a pointer to the next character after the first '\n' is stored in the buffer indicated by pPos. Otherwise, NULL is stored in the buffer.

When a vertically written font is used, this function will draw a text string with the point given by (x, y) at the upper right corner of the first character.

## Sample Code

`

    // Draw overlapping half-lines
        const int linefeed = NNS_G2dFontGetLineFeed(NNS_G2dTextCanvasGetFont(&tc)) / 2;
        const char* str = "abcdefg\nghijk\nlmn";
        int x = 0;
        int y = 0;

        while( str != NULL )
        {
            NNS_G2dTextCanvasDrawString(&tc, x, y, color, str, &str);
            y += linefeed;
        }

`

## See Also

``

## Revision History

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

CONFIDENTIAL