# NNS_G2dFontGetTextRect

## Syntax

      #include <nnsys/g2d/g2d_Font.h>

      NNSG2dTextRect NNS_G2dFontGetTextRect(
      	const NNSG2dFont* pFont,
      	int hSpace,
      	int vSpace,
      	const NNSG2dChar* txt
      );

## Arguments

pFont | [IN] Pointer to font
hSpace | [IN] Character interval (in pixels)
vSpace | [IN] Line interval (in pixels)
txt | [IN] Pointer to text string

## Return Values

Returns the width and the height of a drawn text string. (In pixels.)

## Description

Calculates the height and width that string txt has when drawn.

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 txt. When `TextCanvas` is already created, use `NNS_G2dTextCanvasGetTextRect`.

For vertically written fonts, this function will calculate width and height, but they are swapped.

## See Also

``

## Revision History

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

CONFIDENTIAL