libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

grapheme.h (2782B)


      1 /* See LICENSE file for copyright and license details. */
      2 #ifndef GRAPHEME_H
      3 #define GRAPHEME_H
      4 
      5 #include <stdbool.h>
      6 #include <stddef.h>
      7 #include <stdint.h>
      8 
      9 #define GRAPHEME_INVALID_CODEPOINT UINT32_C(0xFFFD)
     10 
     11 enum grapheme_bidirectional_direction {
     12 	GRAPHEME_BIDIRECTIONAL_DIRECTION_NEUTRAL,
     13 	GRAPHEME_BIDIRECTIONAL_DIRECTION_LTR,
     14 	GRAPHEME_BIDIRECTIONAL_DIRECTION_RTL,
     15 };
     16 
     17 size_t grapheme_bidirectional_get_line_embedding_levels(const uint_least32_t *,
     18                                                         size_t, int_least8_t *,
     19                                                         size_t);
     20 
     21 size_t grapheme_bidirectional_preprocess_paragraph(
     22 	const uint_least32_t *, size_t, enum grapheme_bidirectional_direction,
     23 	uint_least32_t *, size_t, enum grapheme_bidirectional_direction *);
     24 
     25 size_t grapheme_bidirectional_reorder_line(const uint_least32_t *,
     26                                            const uint_least32_t *, size_t,
     27                                            uint_least32_t *, size_t);
     28 
     29 size_t grapheme_decode_utf8(const char *, size_t, uint_least32_t *);
     30 size_t grapheme_encode_utf8(uint_least32_t, char *, size_t);
     31 
     32 bool grapheme_is_character_break(uint_least32_t, uint_least32_t,
     33                                  uint_least16_t *);
     34 
     35 bool grapheme_is_lowercase(const uint_least32_t *, size_t, size_t *);
     36 bool grapheme_is_titlecase(const uint_least32_t *, size_t, size_t *);
     37 bool grapheme_is_uppercase(const uint_least32_t *, size_t, size_t *);
     38 
     39 bool grapheme_is_lowercase_utf8(const char *, size_t, size_t *);
     40 bool grapheme_is_titlecase_utf8(const char *, size_t, size_t *);
     41 bool grapheme_is_uppercase_utf8(const char *, size_t, size_t *);
     42 
     43 size_t grapheme_next_character_break(const uint_least32_t *, size_t);
     44 size_t grapheme_next_line_break(const uint_least32_t *, size_t);
     45 size_t grapheme_next_sentence_break(const uint_least32_t *, size_t);
     46 size_t grapheme_next_word_break(const uint_least32_t *, size_t);
     47 
     48 size_t grapheme_next_character_break_utf8(const char *, size_t);
     49 size_t grapheme_next_line_break_utf8(const char *, size_t);
     50 size_t grapheme_next_sentence_break_utf8(const char *, size_t);
     51 size_t grapheme_next_word_break_utf8(const char *, size_t);
     52 
     53 size_t grapheme_to_lowercase(const uint_least32_t *, size_t, uint_least32_t *,
     54                              size_t);
     55 size_t grapheme_to_titlecase(const uint_least32_t *, size_t, uint_least32_t *,
     56                              size_t);
     57 size_t grapheme_to_uppercase(const uint_least32_t *, size_t, uint_least32_t *,
     58                              size_t);
     59 
     60 size_t grapheme_to_lowercase_utf8(const char *, size_t, char *, size_t);
     61 size_t grapheme_to_titlecase_utf8(const char *, size_t, char *, size_t);
     62 size_t grapheme_to_uppercase_utf8(const char *, size_t, char *, size_t);
     63 
     64 #endif /* GRAPHEME_H */