Calculate the width of a char string of multibyte UTF-8 characters
#include <photon/Pf.h> int PfTextWidthChars( const char *font, const char *str, int len );
ph
PfTextWidthChars() 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
PfTextWidthBytes() is similar, but you pass it the number of bytes in the string, not 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 |
PfGenerateFontName(), PfTextWidthBytes()
Fonts chapter of the Photon Programmer's Guide