diff options
| author | Mattias Andrée <m@maandree.se> | 2026-10-17 23:52:03 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-10-17 23:52:03 +0200 |
| commit | 91ecf7cc0e0aa185495c7342207099b6f13702ff (patch) | |
| tree | 5a156b73b2615066d6dc6b6642ac11bbc53b07fe | |
| parent | m (diff) | |
| download | libcmap-91ecf7cc0e0aa185495c7342207099b6f13702ff.tar.gz libcmap-91ecf7cc0e0aa185495c7342207099b6f13702ff.tar.bz2 libcmap-91ecf7cc0e0aa185495c7342207099b6f13702ff.tar.xz | |
Add to codepoint data whether the codepoint is a character or not
Signed-off-by: Mattias Andrée <m@maandree.se>
| -rw-r--r-- | UnicodeData.parse.c | 11 | ||||
| -rw-r--r-- | libcmap.h | 8 |
2 files changed, 17 insertions, 2 deletions
diff --git a/UnicodeData.parse.c b/UnicodeData.parse.c index a5879b9..f9b676c 100644 --- a/UnicodeData.parse.c +++ b/UnicodeData.parse.c @@ -129,10 +129,12 @@ static int output_character_data(char *text) { char *field, *numeric_value = NULL, *simple_uppercase_mapping; + unsigned long int codepoint; const char *formatted; size_t n, i; - if (!(field = split(&text))) return 0; /* codepoint */ + if (!(field = split(&text))) return 0; + codepoint = strtoul(field, &field, 16); if (!(field = split(&text))) return 0; add_linef(".name = \"%s\"", field); @@ -145,6 +147,13 @@ output_character_data(char *text) if (!(field = split(&text))) return 0; add_linef(", .bidirectional_category = BIDIRECTIONAL_CATEGORY_%s", field); + if (strcmp(field, "Cn")) { + add_linef(", .noncharacter = 0"); + } else if ((0xFDD0u <= codepoint && codepoint <= 0xFDEFu) || (codepoint & 0xFFFEu) == 0xFFFEu) { + add_linef(", .noncharacter = 1"); + } else { + add_linef(", .noncharacter = 0"); + } if (!(field = split(&text))) return 0; if (!*field) { @@ -76,6 +76,11 @@ enum libcmap_general_category { LIBCMAP_GENERAL_CATEGORY_OTHER_FORMAT, LIBCMAP_GENERAL_CATEGORY_OTHER_SURROGATE, LIBCMAP_GENERAL_CATEGORY_OTHER_PRIVATE_USE, + + /** + * This category has two subcategories: noncharacter and reserved + * If .noncharacter it is not a character, otherwise it is reserved + */ LIBCMAP_GENERAL_CATEGORY_OTHER_NOT_ASSIGNED }; @@ -240,7 +245,8 @@ struct libcmap_codepoint_data { uint32_t simple_titlecase_mapping : 21; uint32_t decomposition_mapping_size : 6; uint32_t bidirectional_mirrored : 1; - uint32_t : 4; + uint32_t noncharacter : 1; + uint32_t : 3; }; |
