NNS_G2dTextCanvasGetStringWidth

C Specification


#include <nnsys/g2d/g2d_TextCanvas.h>

int NNS_G2dTextCanvasGetStringWidth(
	const NNSG2dTextCanvas* pTxn,
	const NNSG2dChar* str,
	const NNSG2dChar** pPos
);

Arguments

pTxn [IN] Pointer to TextCanvas
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 drawn width of a single text string ( in pixels).

Description

Calculates the drawn width of a single text string. The width for the drawing of the text string from str to '\n' (0x0A) or '\0'.

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

Calculates the character height for a vertically written font.

Sample Code

	// Get the sum total text-string length for all lines
    const char* str = "abcdefg\n" "ghijk\n" "lmn";
    int sum = 0;
    
    while( str != NULL )
    {
        sum += NNS_G2dTextCanvasGetStringWidth(&tc, str, &str);
    }

See Also

NNS_G2dFontGetStringWidth, NNS_G2dTextCanvasGetTextWidth, NNS_G2dTextCanvasGetTextHeight, NNS_G2dTextCanvasGetTextRect

Revision History

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


CONFIDENTIAL