[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PfWideTextWidthBytes()

Calculate the width of a uint16_t string of Unicode characters

Synopsis:

#include <photon/Pf.h>
int PfWideTextWidthBytes( const char *font,
                          const uint16_t *str,
                          int len );

Arguments:

font
The name of the desired font. Use PfGenerateFontName() to create the name.
str
A uint16_t string of Unicode characters.
len
The length of the string, in bytes. If len is 0, strlen(str) is assumed.

Library:

ph

Description:

PfWideTextWidthBytes() is a convenience function that calculates the width of the given string in the given font, using the formula:

extent.lr.x - min(extent.ul.x, 0) + 1

Note: This function assumes each character is represented by 2 bytes that conform to the ISO/IEC 10646-1 UCS-2 double-byte format.

PfWideTextWidthChars() is similar, but you give it the number of characters in the string instead of the number of bytes.

Returns:

The width of the string, or 0 if an error occurred.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PfGenerateFontName(), PfTextWidthBytes() PfTextWidthChars() PfWideTextWidthChars()

Fonts chapter of the Photon Programmer's Guide


[Previous] [Contents] [Index] [Next]