![]()  | 
![]()  | 
![]()  | 
![]()  | 
Calculate the width of a uint16_t string of Unicode characters
#include <photon/Pf.h>
int PfWideTextWidthChars( const char *font,
                          const uint16_t *str,
                          int len );
ph
PfWideTextWidthChars() 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
![]()  | 
This function assumes each character is represented by 2 bytes that conform to the ISO/IEC 10646-1 UCS-2 double-byte format. | 
PfWideTextWidthBytes() is similar, but you pass it the number of bytes in the string, rather than the number of characters.
The width of the string, or 0 if an error occurred.
Photon
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | No | 
PfTextWidthBytes(), PfTextWidthChars(), PfWideTextWidthBytes()
Fonts chapter of the Photon Programmer's Guide
![]()  | 
![]()  | 
![]()  | 
![]()  |