# NNS_G2dFontGetStringWidth

## Syntax

      #include <nnsys/g2d/g2d_Font.h>

      int NNS_G2dFontGetStringWidth(
      	const NNSG2dFont* pFont,
      	int hSpace,
      	const NNSG2dChar* str,
      	const NNSG2dChar** pPos
      );

## Arguments

pFont | [IN] Pointer to font
hSpace | [IN] Character interval (in pixels)
str | [IN] Pointer to text string
pPos | [OUT] Pointer to the buffer that holds the pointer to the next line. (Can be NULL.)

## Return Values

Returns the line width of a drawn string. (in pixels).

## Description

Calculates the width that one line of the string has when drawn. The width is for the drawing of the 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.

For information on the other arguments, see `NNS_G2dTextCanvasInit`.

Use this function when you want to know the size of the string before creating the `TextCanvas`. For example, use it when you are dynamically creating the smallest `CharCanvas` that can display all of str . When `TextCanvas` is already created, use `NNS_G2dTextCanvasGetStringWidth`.

For a vertically written font, this function calculates the string's height.

## See Also

``

## Revision History

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

CONFIDENTIAL