summaryrefslogtreecommitdiff
path: root/include/term/unicode/grapheme.h
blob: 0946bb6cfada3fae44e9541b303ae5a2af5f9887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef TERM_UNICODE_GRAPHEME_H
#define TERM_UNICODE_GRAPHEME_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define TERM_GRAPHEME_MAX_LEN 20
#define TERM_GRAPHEME_HANDLE_BASE 0x7F000000u

static inline bool term_grapheme_is_handle(uint32_t c)
{
    return c >= TERM_GRAPHEME_HANDLE_BASE;
}

static inline bool term_grapheme_regional_indicator(uint32_t cp)
{
    return cp >= 0x1F1E6 && cp <= 0x1F1FF;
}

static inline bool term_grapheme_emoji_modifier(uint32_t cp)
{
    return cp >= 0x1F3FB && cp <= 0x1F3FF;
}

#endif