![]() |
![]() |
![]() |
![]() |
Calculate the width of a wchar_t string of Unicode characters
int PfWideTextWidthBytes( const char *font, const wchar_t *str, int len );
ph
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
The font argument is the name of the desired font. You should use PfGenerateFontName() to create this.
The str argument is a wchar_t string of Unicode characters. The len argument gives the length of the string, in bytes. If len is 0, strlen(str) is assumed.
![]() |
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.
The width of the string, or 0 if an error occurred.
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PfGenerateFontName(), PfTextWidthBytes() PfTextWidthChars() PfWideTextWidthChars()
Fonts chapter of the Photon Programmer's Guide
![]() |
![]() |
![]() |
![]() |