aboutsummaryrefslogtreecommitdiffstats
path: root/text/text.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 12:48:45 +0100
committereunhhu <[email protected]>2026-09-28 12:48:45 +0100
commit16d84b2530e154795a825fbf2b7e028e2f209b71 (patch)
tree4e90cc9b2b64a01460031941983d73acc7d883c5 /text/text.h
parent482d3c93255277f5251008638bc59bfab0eb4b9e (diff)
downloadvega-16d84b2530e154795a825fbf2b7e028e2f209b71.tar.gz
vega-16d84b2530e154795a825fbf2b7e028e2f209b71.zip
Generate the Unicode properties shaping needs
Joining types, general categories and scripts (with their ISO 15924 codes) as two-stage tables, canonical decompositions one step at a time, and Extended_Pictographic, from the UCD by text/unicode.py.
Diffstat (limited to 'text/text.h')
-rw-r--r--text/text.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/text/text.h b/text/text.h
index 40503c0..3704bbd 100644
--- a/text/text.h
+++ b/text/text.h
@@ -21,12 +21,44 @@ int vega_bracket(uint32_t code, uint32_t *pair);
/* The character that mirrors code (Bidi_Mirroring_Glyph), or 0. */
uint32_t vega_mirror(uint32_t code);
+/* Joining_Type (Arabic and others' cursive joining: U non-joining, D dual,
+ * R right, L left, C join-causing, T transparent), General_Category (in the
+ * order of text/unicode.py) and Script. */
+typedef enum { VEGA_JOINING_U, VEGA_JOINING_D, VEGA_JOINING_R, VEGA_JOINING_L, VEGA_JOINING_C, VEGA_JOINING_T } VegaJoining;
+typedef enum {
+ VEGA_CN, VEGA_LU, VEGA_LL, VEGA_LT, VEGA_LM, VEGA_LO, VEGA_MN, VEGA_MC, VEGA_ME, VEGA_ND, VEGA_NL, VEGA_NO, VEGA_PC,
+ VEGA_PD, VEGA_PS, VEGA_PE, VEGA_PI, VEGA_PF, VEGA_PO, VEGA_SM, VEGA_SC, VEGA_SK, VEGA_SO, VEGA_ZS, VEGA_ZL, VEGA_ZP,
+ VEGA_CC, VEGA_CF, VEGA_CS, VEGA_CO
+} VegaCategory;
+/* Scripts in the order Scripts.txt first names them (text/unicode.py checks
+ * the ones named here). */
+typedef uint8_t VegaScript;
+enum { VEGA_SCRIPT_UNKNOWN = 0, VEGA_SCRIPT_COMMON = 1, VEGA_SCRIPT_INHERITED = 2, VEGA_SCRIPT_LATIN = 3,
+ VEGA_SCRIPT_GREEK = 4, VEGA_SCRIPT_CYRILLIC = 5, VEGA_SCRIPT_HEBREW = 7, VEGA_SCRIPT_ARABIC = 8,
+ VEGA_SCRIPT_HANGUL = 26 };
+VegaJoining vega_joining(uint32_t code);
+VegaCategory vega_category(uint32_t code);
+VegaScript vega_script(uint32_t code);
+const char *vega_script_name(VegaScript);
+/* A script's ISO 15924 code as a tag: 'Latn' is 0x4C61746E. */
+uint32_t vega_script_code(VegaScript);
+/* Extended_Pictographic (emoji-data.txt). */
+bool vega_extended_pictographic(uint32_t code);
+static inline bool vega_mark(uint32_t code) {
+ VegaCategory c = vega_category(code);
+ return c == VEGA_MN || c == VEGA_MC || c == VEGA_ME;
+}
+
/* Canonical_Combining_Class; a code point's full canonical decomposition
* (0 when it has none; Hangul syllables are left to vega_nfd); the primary
* composite of two code points, or 0. */
uint8_t vega_combining_class(uint32_t code);
size_t vega_decomposition(uint32_t code, const uint32_t **out);
uint32_t vega_composition(uint32_t first, uint32_t second);
+/* A code point's canonical decomposition mapping, one step: into first and
+ * second, or first alone (second 0); false when it has none (Hangul
+ * syllables included: they are left to arithmetic). */
+bool vega_decomposition_step(uint32_t code, uint32_t *first, uint32_t *second);
/* Normalization forms D and C (UAX #15): out has room for 4 * count code
* points (the most one decomposes into); returns how many it holds. */
size_t vega_nfd(const uint32_t *in, size_t count, uint32_t *out);