table of contents
caca_charset(3caca) | libcaca | caca_charset(3caca) |
NAME¶
caca_charset - libcaca character set conversions
SYNOPSIS¶
Topics¶
libcaca primitives drawing
Functions¶
__extern uint32_t caca_utf8_to_utf32 (char const *, size_t
*)
Convert a UTF-8 character to UTF-32. __extern size_t caca_utf32_to_utf8
(char *, uint32_t)
Convert a UTF-32 character to UTF-8. __extern uint8_t
caca_utf32_to_cp437 (uint32_t)
Convert a UTF-32 character to CP437. __extern uint32_t
caca_cp437_to_utf32 (uint8_t)
Convert a CP437 character to UTF-32. __extern char caca_utf32_to_ascii
(uint32_t)
Convert a UTF-32 character to ASCII. __extern int
caca_utf32_is_fullwidth (uint32_t)
Tell whether a UTF-32 character is fullwidth.
Detailed Description¶
These functions perform conversions between usual character sets.
Function Documentation¶
__extern uint32_t caca_utf8_to_utf32 (char const * s, size_t * bytes)¶
Convert a UTF-8 character read from a string and return its value in the UTF-32 character set. If the second argument is not null, the total number of read bytes is written in it.
If a null byte was reached before the expected end of the UTF-8 sequence, this function returns zero and the number of read bytes is set to zero.
This function never fails, but its behaviour with illegal UTF-8 sequences is undefined.
Parameters
bytes A pointer to a size_t to store the number of bytes in the character, or NULL.
Returns
Referenced by caca_put_str().
__extern size_t caca_utf32_to_utf8 (char * buf, uint32_t ch)¶
Convert a UTF-32 character read from a string and write its value in the UTF-8 character set into the given buffer.
This function never fails, but its behaviour with illegal UTF-32 characters is undefined.
Parameters
ch The UTF-32 character.
Returns
__extern uint8_t caca_utf32_to_cp437 (uint32_t ch)¶
Convert a UTF-32 character read from a string and return its value in the CP437 character set, or '?' if the character has no equivalent.
This function never fails.
Parameters
Returns
__extern uint32_t caca_cp437_to_utf32 (uint8_t ch)¶
Convert a CP437 character read from a string and return its value in the UTF-32 character set, or zero if the character is a CP437 control character.
This function never fails.
Parameters
Returns
__extern char caca_utf32_to_ascii (uint32_t ch)¶
Convert a UTF-32 character into an ASCII character. When no equivalent exists, a graphically close equivalent is sought.
This function never fails, but its behaviour with illegal UTF-32 characters is undefined.
Parameters
Returns
__extern int caca_utf32_is_fullwidth (uint32_t ch)¶
Check whether the given UTF-32 character should be printed at twice the normal width (fullwidth characters). If the character is unknown or if its status cannot be decided, it is treated as a standard-width character.
This function never fails.
Parameters
Returns
Referenced by caca_put_char(), and caca_put_str().
Author¶
Generated automatically by Doxygen for libcaca from the source code.
Mon Jun 17 2024 19:39:46 | Version 0.99.beta20 |