FcUtf16Len(3)

okay so welcome to the FcUtf16Len page from the fontconfig manual, bestie πŸ’…βœ¨ this one is short and sweet and it’s all about counting UTF-16 encoded chars, no cap πŸ¦‹

πŸŽ€ NAME πŸŽ€

FcUtf16Len β€” count UTF-16 encoded chars. that’s literally the whole name and honestly it ate πŸ’…


✨ SYNOPSIS ✨

include this header and call it like so, bestie:

#include <fontconfig/fontconfig.h>

FcBool FcUtf16Len (FcChar8 *src, FcEndian endian, int len, int *nchar, int *wchar);

🌸 DESCRIPTION 🌸

okay so here’s the tea: FcUtf16Len counts the number of Unicode chars in len bytes of src. Bytes of src are combined into 16-bit units according to endian. 🫢

the count gets placed in nchar ✨

and wchar contains 1, 2 or 4 depending on the number of bytes needed to hold the largest Unicode char counted πŸ‘‘

the FcBool return value indicates whether string is a well-formed UTF16 string β€” it’s giving vibe check for UTF16, fr fr πŸ’–

here’s the parameter lineup so nobody gets confused 😭

  • src β€” the bytes we’re looking at; we count Unicode chars in len bytes of it.
  • endian β€” decides how bytes of src get combined into 16-bit units.
  • len β€” how many bytes of src we’re counting.
  • nchar β€” where that count gets placed.
  • wchar β€” contains 1, 2 or 4 depending on the number of bytes needed to hold the largest Unicode char counted.

this page was brought to you by Fontconfig 2.17.0, dated 27 June 2025 πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from