|
LCDGFX LCD display driver
1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
|
Stateless UTF-8 decoder helpers. More...
#include <stdint.h>#include <stddef.h>
Go to the source code of this file.
Macros | |
| #define | NANO_UTF8_INVALID 0xFFFFFFFFu |
| Sentinel value returned by nano_utf8_decode() when the input is malformed, truncated, or contains an invalid sequence. | |
Functions | |
| static uint32_t | nano_utf8_decode (const char **p, const char *end) |
Decode a single UTF-8 codepoint from p in a stateless way. More... | |
Stateless UTF-8 decoder helpers.
Definition in file font_utf8.h.
|
inlinestatic |
Decode a single UTF-8 codepoint from p in a stateless way.
Unlike NanoFont::unicode16FromUtf8(), which keeps internal static state and returns a 16-bit truncated codepoint, this helper decodes a full 21-bit Unicode codepoint and never mutates global state, so it is safe to use from re-entrant contexts.
On entry p must point at the first byte of a UTF-8 sequence. On successful return p is advanced past the decoded sequence and the codepoint is returned. The decoder stops at the NUL byte; if end is non-NULL the decoder never reads past end.
The following inputs are reported as invalid (return value NANO_UTF8_INVALID, p advanced by one byte to allow resynchronisation):
| p | in/out pointer to the next byte to decode. Must not be NULL. |
| end | optional end-of-buffer guard, may be NULL for NUL-terminated input. |
Definition at line 73 of file font_utf8.h.