#include <nnsys/g2d/g2d_TextCanvas.h>
int NNS_G2dTextCanvasGetStringWidth(
const NNSG2dTextCanvas* pTxn,
const NNSG2dChar* str,
const NNSG2dChar** pPos
);
| 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) |
Returns the drawn width of a single text string ( in pixels).
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.
// 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);
}
NNS_G2dFontGetStringWidth, NNS_G2dTextCanvasGetTextWidth, NNS_G2dTextCanvasGetTextHeight, NNS_G2dTextCanvasGetTextRect
05/25/2005 Initial version.