diff options
author | 2018-04-04 22:36:09 -0400 | |
---|---|---|
committer | 2018-04-04 22:36:09 -0400 | |
commit | 65f254f3fbc83d006d4ec29170ec8a8695345d6c (patch) | |
tree | 3044fb62120ca23499d31275076af50db09a9850 /include/unicode.h | |
parent | fix focus child (diff) | |
parent | Merge pull request #1732 from emersion/view-children (diff) | |
download | sway-65f254f3fbc83d006d4ec29170ec8a8695345d6c.tar.gz sway-65f254f3fbc83d006d4ec29170ec8a8695345d6c.tar.zst sway-65f254f3fbc83d006d4ec29170ec8a8695345d6c.zip |
Merge branch 'wlroots' into fix-focus-inactive
Diffstat (limited to 'include/unicode.h')
-rw-r--r-- | include/unicode.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/unicode.h b/include/unicode.h new file mode 100644 index 00000000..e2ee9588 --- /dev/null +++ b/include/unicode.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _SWAY_UNICODE_H | ||
2 | #define _SWAY_UNICODE_H | ||
3 | #include <stddef.h> | ||
4 | #include <stdint.h> | ||
5 | |||
6 | // Technically UTF-8 supports up to 6 byte codepoints, but Unicode itself | ||
7 | // doesn't really bother with more than 4. | ||
8 | #define UTF8_MAX_SIZE 4 | ||
9 | |||
10 | #define UTF8_INVALID 0x80 | ||
11 | |||
12 | /** | ||
13 | * Grabs the next UTF-8 character and advances the string pointer | ||
14 | */ | ||
15 | uint32_t utf8_decode(const char **str); | ||
16 | |||
17 | /** | ||
18 | * Encodes a character as UTF-8 and returns the length of that character. | ||
19 | */ | ||
20 | size_t utf8_encode(char *str, uint32_t ch); | ||
21 | |||
22 | /** | ||
23 | * Returns the size of the next UTF-8 character | ||
24 | */ | ||
25 | int utf8_size(const char *str); | ||
26 | |||
27 | /** | ||
28 | * Returns the size of a UTF-8 character | ||
29 | */ | ||
30 | size_t utf8_chsize(uint32_t ch); | ||
31 | |||
32 | #endif | ||
33 | |||