aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 11:41:43 +0100
committereunhhu <[email protected]>2026-09-28 11:41:43 +0100
commit8ba0615b0fe832a15eb695ccd661674b6946995c (patch)
treeaa1f9d2515c63ab18ac799ac33c89db912bbfb41
parentebae1463d5521f2d08641ba1c52fece29a317a9c (diff)
downloadvega-8ba0615b0fe832a15eb695ccd661674b6946995c.tar.gz
vega-8ba0615b0fe832a15eb695ccd661674b6946995c.zip
Resolve bidirectional text as UAX #9 does, passing all of Unicode's bidi tests
-rw-r--r--Makefile12
-rw-r--r--docs/design/004-text.md42
-rw-r--r--text/bidi.c351
-rw-r--r--text/test-text.c139
-rw-r--r--text/text.h37
-rw-r--r--text/unicode-data.c1775
-rw-r--r--text/unicode.py134
7 files changed, 2488 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e00385c..f96fb29 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,8 @@ LIBPURE = $(PURE)/build/libpure.a
# Parts: lib/ (the aup library: the interface vocabulary), surfaces/ (the vega
# host: TUI, CLI, NUI sentences, web), symbols/ (glyphs and icons as one
-# format, drawn by CPU or GPU).
+# format, drawn by CPU or GPU), text/ (Unicode's algorithms over tables
+# text/unicode.py generates from the UCD: python3 text/unicode.py > text/unicode-data.c).
SURFACES = surfaces/screen.c surfaces/draw.c surfaces/width.c surfaces/web.c surfaces/pixels.c surfaces/display.c \
surfaces/input.c surfaces/hangul.c surfaces/main.c
@@ -48,7 +49,14 @@ $(BUILD)/vega-symbols: symbols/symbols-tool.c $(SYMBOLS) symbols/symbols.h symbo
$(CC) $(CPPFLAGS) $(CFLAGS) $(FREETYPE_CFLAGS) symbols/symbols-tool.c $(SYMBOLS) $(LDFLAGS) \
$(FREETYPE_LIBS) $(GL_LIBS) -lm $(LDLIBS) -o $@
-check: $(BUILD)/vega $(BUILD)/vega-symbols $(BUILD)/vega-surface.so
+TEXT = text/bidi.c text/unicode-data.c
+$(BUILD)/test-text: text/test-text.c $(TEXT) text/text.h | $(BUILD)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -Itext text/test-text.c $(TEXT) $(LDFLAGS) $(LDLIBS) -o $@
+
+# Unicode's conformance tests, where the UCD is installed (Debian: unicode-data).
+UCD ?= /usr/share/unicode
+check: $(BUILD)/vega $(BUILD)/vega-symbols $(BUILD)/vega-surface.so $(BUILD)/test-text
+ if [ -f $(UCD)/BidiTest.txt ]; then $(BUILD)/test-text $(UCD); else echo "no UCD at $(UCD): text tests skipped"; fi
$(MAKE) -C $(AUP) build/aup
$(MAKE) -C $(PURE) build/pure-serve
python3 tests/check.py --vega $(BUILD)/vega --symbols $(BUILD)/vega-symbols --aup $(AUP)/build/aup --serve $(PURE)/build/pure-serve
diff --git a/docs/design/004-text.md b/docs/design/004-text.md
new file mode 100644
index 0000000..703967b
--- /dev/null
+++ b/docs/design/004-text.md
@@ -0,0 +1,42 @@
+# 004 — 글자: 양방향, 합성, 셰이핑을 빌드할 때 컴파일한 표로
+
+2026-09-28. Pure 외부 피드백 002의 셋째 항목. [002](002-symbol-format.md)는 FreeType을 실행 중에서 빼고 글꼴을
+빌드할 때 곡선 레코드로 바꿨다. 그 대가로 Vega는 코드 포인트 하나를 글리프 하나로 그렸다. 합자, 커닝, 아랍 문자의 위치별
+형태, 결합 부호의 자리, 오른쪽에서 왼쪽으로 쓰는 글(양방향)이 없었다.
+
+착수 기준:
+
+- 바꿀 결정: 셰이핑을 실행 중에 OpenType 표(GSUB, GPOS)를 해석해서 할지(HarfBuzz의 방식), 빌드할 때 글꼴의 행동을
+ 단순한 표로 컴파일해 두고 실행 중에는 검증한 표를 제자리에서 읽기만 할지. 심볼과 같은 원칙이면 뒤쪽이다.
+- 남은 질문: 컴파일한 표만으로 HarfBuzz와 같은 글리프와 자리가 나오는가? 어느 문자 체계까지인가? 양방향과 합성은 유니코드의
+ 적합성 시험을 모두 통과하는가?
+- 최소 확인: 유니코드 15.1의 `BidiTest.txt`(49만 줄)와 `BidiCharacterTest.txt`(9.6만 줄), `NormalizationTest.txt`를 모두
+ 통과한다. 셰이핑은 라틴(커닝, 합자), 아랍(위치별 형태, lam-alef, 결합 부호), 히브리(결합 부호) 문장에서 HarfBuzz 10.2와
+ 글리프와 자리가 같다.
+- 중단 기준: 적합성 시험에 틀린 줄이 하나라도 있으면 그 단계를 쓰지 않는다. 셰이핑이 HarfBuzz와 다른 문장은 원인을 찾을
+ 때까지 그 문자 체계를 받지 않는다(빌드 도구가 거부한다).
+
+## 단계
+
+1. 유니코드 성질 표: UCD에서 생성한 두 단계 표(코드 포인트 → 값). [text/unicode.py](../../text/unicode.py)가
+ [text/unicode-data.c](../../text/unicode-data.c)를 만든다.
+2. 양방향(UAX #9): 문단 수준, 명시적 수준과 격리(X1–X10), 약한 형(W1–W7), 괄호 쌍(N0), 중립(N1–N2), 암시적 수준(I1–I2),
+ 줄(L1)과 보이는 순서(L2).
+3. 정규화: 한글 음절과 정준 합성(NFC).
+4. 셰이핑: 빌드 도구가 글꼴마다 HarfBuzz로 커닝 쌍, 합자, 위치별 형태, 결합 부호의 자리를 뽑아 심볼 파일에 넣는다. 실행 중에는
+ 그 표를 찾아 쓴다.
+5. 비례폭 글줄: 셰이핑한 글리프를 제 advance로 늘어놓아 그린다.
+6. 접근성.
+
+## 양방향
+
+[text/bidi.c](../../text/bidi.c)는 UAX #9를 규칙 이름 그대로 짠다. 문단 수준(P2–P3), 명시적 수준과 방향 상태 스택(깊이
+125, 넘친 격리·내장·유효 격리의 계수, X1–X8), 제거(X9)와 격리 실행 열(X10: 격리 시작자로 끝나는 실행은 짝 PDI로 시작하는
+실행으로 이어지고, sos와 eos는 명시적 수준으로 정한다), 약한 형(W1–W7), 괄호 쌍(N0: 깊이 63의 스택, U+2329·232A와
+U+3008·3009의 정준 동치, 바뀐 괄호 뒤의 결합 부호), 중립(N1–N2), 암시적 수준(I1–I2), 그리고 한 줄로서의 L1과 보이는
+순서(L2)다. 성질은 UCD에서 만든 표다(양방향 클래스는 두 단계 표 37 KiB, 괄호 128개, 거울 글자 428개).
+
+유니코드 15.1의 적합성 시험을 모두 통과한다. `BidiTest.txt`의 770,241 경우(클래스 열마다 비트 집합이 가리키는 문단 방향)와
+`BidiCharacterTest.txt`의 91,707 경우(코드 포인트, 괄호 포함)에서 수준과 보이는 순서가 하나도 틀리지 않는다. Pi 5에서 전체가
+0.74초다. 처음 짠 것은 148 경우가 틀렸다. 앞선 격리 실행 열의 암시적 수준(I1–I2)이 바꾼 수준으로 다음 열의 sos를 정했기
+때문이다(sos와 eos는 명시적 수준으로 정해야 한다).
diff --git a/text/bidi.c b/text/bidi.c
new file mode 100644
index 0000000..d2f95c9
--- /dev/null
+++ b/text/bidi.c
@@ -0,0 +1,351 @@
+/* The Unicode Bidirectional Algorithm (UAX #9, Unicode 15.1), for one
+ * paragraph laid out as one line: text/text.h. Rules are named as in the
+ * annex; the tests are Unicode's own (BidiTest.txt, BidiCharacterTest.txt). */
+#include "text.h"
+#include <stdlib.h>
+#include <string.h>
+
+enum { MAX_DEPTH = 125, BRACKETS = 63 };
+typedef VegaBidiClass Class;
+
+static bool initiator(Class c) { return c == VEGA_BIDI_LRI || c == VEGA_BIDI_RLI || c == VEGA_BIDI_FSI; }
+static bool removed(Class c) {
+ return c == VEGA_BIDI_RLE || c == VEGA_BIDI_LRE || c == VEGA_BIDI_RLO || c == VEGA_BIDI_LRO || c == VEGA_BIDI_PDF ||
+ c == VEGA_BIDI_BN;
+}
+/* Neutral or isolate formatting character (NI). */
+static bool neutral(Class c) {
+ return c == VEGA_BIDI_B || c == VEGA_BIDI_S || c == VEGA_BIDI_WS || c == VEGA_BIDI_ON || initiator(c) ||
+ c == VEGA_BIDI_PDI;
+}
+/* A strong direction for N0 and N1: L, or R for R, AL, EN and AN; else -1. */
+static int strong(Class c) {
+ if (c == VEGA_BIDI_L) return VEGA_BIDI_L;
+ if (c == VEGA_BIDI_R || c == VEGA_BIDI_AL || c == VEGA_BIDI_EN || c == VEGA_BIDI_AN) return VEGA_BIDI_R;
+ return -1;
+}
+
+/* P2-P3 over [from, to): 1 when the first strong character (skipping
+ * isolates to their matching PDI) is R or AL, 0 when it is L, -1 when there
+ * is none. */
+static int first_strong(const Class *t, const size_t *match, size_t from, size_t to) {
+ for (size_t i = from; i < to; ++i) {
+ if (t[i] == VEGA_BIDI_L) return 0;
+ if (t[i] == VEGA_BIDI_R || t[i] == VEGA_BIDI_AL) return 1;
+ if (initiator(t[i])) {
+ if (match[i] >= to) return -1;
+ i = match[i];
+ }
+ }
+ return -1;
+}
+
+/* U+2329 and U+232A are canonically U+3008 and U+3009 (BD16). */
+static uint32_t canonical(uint32_t code) { return code == 0x2329 ? 0x3008 : code == 0x232A ? 0x3009 : code; }
+
+typedef struct { size_t open, close; } Pair; /* positions in a sequence of an opening bracket and its closing one */
+
+typedef struct {
+ const Class *original;
+ Class *t;
+ uint8_t *levels;
+ const uint32_t *codes;
+ size_t *seq; /* the isolating run sequence's characters */
+ size_t count;
+ uint8_t level;
+ Class sos, eos;
+ Pair *pairs; /* room for count / 2 + 1 */
+} Sequence;
+
+static int by_opening(const void *a, const void *b) {
+ const Pair *x = a, *y = b;
+ return (x->open > y->open) - (x->open < y->open);
+}
+
+static Class before(const Sequence *s, size_t k) { return k ? s->t[s->seq[k - 1]] : s->sos; }
+
+static void weak_types(Sequence *s) {
+ Class *t = s->t;
+ size_t *seq = s->seq, m = s->count;
+ for (size_t k = 0; k < m; ++k) /* W1 */
+ if (t[seq[k]] == VEGA_BIDI_NSM) {
+ Class previous = before(s, k);
+ t[seq[k]] = initiator(previous) || previous == VEGA_BIDI_PDI ? VEGA_BIDI_ON : previous;
+ }
+ Class last = s->sos; /* W2, W3 */
+ for (size_t k = 0; k < m; ++k) {
+ Class c = t[seq[k]];
+ if (c == VEGA_BIDI_L || c == VEGA_BIDI_R || c == VEGA_BIDI_AL) last = c;
+ else if (c == VEGA_BIDI_EN && last == VEGA_BIDI_AL) t[seq[k]] = VEGA_BIDI_AN;
+ }
+ for (size_t k = 0; k < m; ++k)
+ if (t[seq[k]] == VEGA_BIDI_AL) t[seq[k]] = VEGA_BIDI_R;
+ for (size_t k = 1; k + 1 < m; ++k) { /* W4 */
+ Class c = t[seq[k]], p = t[seq[k - 1]], n = t[seq[k + 1]];
+ if (c == VEGA_BIDI_ES && p == VEGA_BIDI_EN && n == VEGA_BIDI_EN) t[seq[k]] = VEGA_BIDI_EN;
+ else if (c == VEGA_BIDI_CS && p == n && (p == VEGA_BIDI_EN || p == VEGA_BIDI_AN)) t[seq[k]] = p;
+ }
+ for (size_t k = 0; k < m;) { /* W5 */
+ if (t[seq[k]] != VEGA_BIDI_ET) { ++k; continue; }
+ size_t end = k;
+ while (end < m && t[seq[end]] == VEGA_BIDI_ET) ++end;
+ bool number = (k && t[seq[k - 1]] == VEGA_BIDI_EN) || (end < m && t[seq[end]] == VEGA_BIDI_EN);
+ for (; k < end; ++k)
+ if (number) t[seq[k]] = VEGA_BIDI_EN;
+ }
+ for (size_t k = 0; k < m; ++k) { /* W6 */
+ Class c = t[seq[k]];
+ if (c == VEGA_BIDI_ES || c == VEGA_BIDI_ET || c == VEGA_BIDI_CS) t[seq[k]] = VEGA_BIDI_ON;
+ }
+ last = s->sos; /* W7 */
+ for (size_t k = 0; k < m; ++k) {
+ Class c = t[seq[k]];
+ if (c == VEGA_BIDI_L || c == VEGA_BIDI_R) last = c;
+ else if (c == VEGA_BIDI_EN && last == VEGA_BIDI_L) t[seq[k]] = VEGA_BIDI_L;
+ }
+}
+
+/* N0: paired brackets take the direction of what they enclose. */
+static void brackets(Sequence *s) {
+ if (!s->codes) return;
+ Class *t = s->t;
+ size_t *seq = s->seq, m = s->count;
+ Pair *pairs = s->pairs;
+ size_t found = 0;
+ struct { uint32_t pair; size_t at; } open[BRACKETS];
+ size_t depth = 0;
+ for (size_t k = 0; k < m; ++k) {
+ uint32_t pair, code = s->codes[seq[k]];
+ int kind = t[seq[k]] == VEGA_BIDI_ON ? vega_bracket(code, &pair) : 0;
+ if (kind == 1) {
+ if (depth == BRACKETS) break; /* BD16: no more pairs in this sequence */
+ open[depth].pair = canonical(pair);
+ open[depth++].at = k;
+ } else if (kind == 2) {
+ for (size_t d = depth; d-- > 0;)
+ if (open[d].pair == canonical(code)) {
+ pairs[found].open = open[d].at, pairs[found++].close = k;
+ depth = d;
+ break;
+ }
+ }
+ }
+ qsort(pairs, found, sizeof(*pairs), by_opening); /* in the order of the opening brackets */
+ Class embedding = s->level & 1 ? VEGA_BIDI_R : VEGA_BIDI_L, opposite = embedding == VEGA_BIDI_L ? VEGA_BIDI_R : VEGA_BIDI_L;
+ for (size_t p = 0; p < found; ++p) {
+ size_t open_at = pairs[p].open, close_at = pairs[p].close;
+ bool same = false, other = false;
+ for (size_t k = open_at + 1; k < close_at; ++k) {
+ int d = strong(t[seq[k]]);
+ if (d == (int)embedding) same = true;
+ else if (d >= 0) other = true;
+ }
+ Class resolved;
+ if (same) resolved = embedding;
+ else if (other) {
+ Class context = s->sos;
+ for (size_t k = open_at; k-- > 0;)
+ if (strong(t[seq[k]]) >= 0) { context = (Class)strong(t[seq[k]]); break; }
+ resolved = context == opposite ? opposite : embedding;
+ } else
+ continue;
+ size_t ends[2] = {open_at, close_at};
+ for (unsigned e = 0; e < 2; ++e) {
+ t[seq[ends[e]]] = resolved;
+ /* Marks that followed the bracket (made ON by W1) follow it. */
+ for (size_t k = ends[e] + 1; k < m && s->original[seq[k]] == VEGA_BIDI_NSM; ++k) t[seq[k]] = resolved;
+ }
+ }
+}
+
+static void neutral_types(Sequence *s) {
+ Class *t = s->t;
+ size_t *seq = s->seq, m = s->count;
+ Class embedding = s->level & 1 ? VEGA_BIDI_R : VEGA_BIDI_L;
+ for (size_t k = 0; k < m;) { /* N1, N2 */
+ if (!neutral(t[seq[k]])) { ++k; continue; }
+ size_t end = k;
+ while (end < m && neutral(t[seq[end]])) ++end;
+ int left = k ? strong(t[seq[k - 1]]) : (int)s->sos, right = end < m ? strong(t[seq[end]]) : (int)s->eos;
+ Class resolved = left >= 0 && left == right ? (Class)left : embedding;
+ for (; k < end; ++k) t[seq[k]] = resolved;
+ }
+ for (size_t k = 0; k < m; ++k) { /* I1, I2 */
+ Class c = t[seq[k]];
+ uint8_t *level = &s->levels[seq[k]];
+ if (!(*level & 1)) *level += c == VEGA_BIDI_R ? 1 : c == VEGA_BIDI_AN || c == VEGA_BIDI_EN ? 2 : 0;
+ else *level += c == VEGA_BIDI_L || c == VEGA_BIDI_EN || c == VEGA_BIDI_AN ? 1 : 0;
+ }
+}
+
+int vega_bidi_levels(const VegaBidiClass *classes, const uint32_t *codes, size_t count, int direction, uint8_t *levels) {
+ if (!count) return direction == VEGA_BIDI_RTL ? 1 : 0;
+ size_t *match = malloc(count * sizeof(*match)), *runs = malloc((count + 1) * sizeof(*runs)),
+ *run_of = malloc(count * sizeof(*run_of)), *seq = malloc(count * sizeof(*seq));
+ Class *t = malloc(count * sizeof(*t));
+ bool *matched_pdi = calloc(count, sizeof(*matched_pdi));
+ Pair *pairs = malloc((count / 2 + 1) * sizeof(*pairs));
+ uint8_t *embedding = malloc(count);
+ int paragraph = -1;
+ if (!match || !runs || !run_of || !seq || !t || !matched_pdi || !pairs || !embedding) goto done;
+ memcpy(t, classes, count * sizeof(*t));
+ /* BD9: each isolate initiator's matching PDI (count: none). */
+ {
+ size_t depth = 0;
+ for (size_t i = 0; i < count; ++i) {
+ match[i] = count;
+ if (initiator(t[i])) runs[depth++] = i; /* runs as a stack here */
+ else if (t[i] == VEGA_BIDI_PDI && depth) {
+ match[runs[--depth]] = i;
+ matched_pdi[i] = true;
+ }
+ }
+ }
+ /* P2, P3 */
+ paragraph = direction == VEGA_BIDI_RTL ? 1 : direction == VEGA_BIDI_LTR ? 0 : first_strong(t, match, 0, count) == 1;
+ /* X1-X8: explicit levels and directions. */
+ struct { uint8_t level; Class override; bool isolate; } stack[MAX_DEPTH + 2];
+ size_t depth = 0;
+ unsigned overflow_isolates = 0, overflow_embeddings = 0, valid_isolates = 0;
+ stack[depth].level = (uint8_t)paragraph, stack[depth].override = VEGA_BIDI_ON, stack[depth++].isolate = false;
+ for (size_t i = 0; i < count; ++i) {
+ Class c = classes[i];
+ uint8_t level = stack[depth - 1].level;
+ switch (c) {
+ case VEGA_BIDI_RLE: case VEGA_BIDI_LRE: case VEGA_BIDI_RLO: case VEGA_BIDI_LRO: {
+ bool rtl = c == VEGA_BIDI_RLE || c == VEGA_BIDI_RLO;
+ uint8_t next = rtl ? (uint8_t)((level + 1) | 1) : (uint8_t)((level + 2) & ~1);
+ levels[i] = level;
+ if (next <= MAX_DEPTH && !overflow_isolates && !overflow_embeddings) {
+ stack[depth].level = next;
+ stack[depth].override = c == VEGA_BIDI_RLO ? VEGA_BIDI_R : c == VEGA_BIDI_LRO ? VEGA_BIDI_L : VEGA_BIDI_ON;
+ stack[depth++].isolate = false;
+ } else if (!overflow_isolates)
+ ++overflow_embeddings;
+ break;
+ }
+ case VEGA_BIDI_RLI: case VEGA_BIDI_LRI: case VEGA_BIDI_FSI: {
+ levels[i] = level;
+ if (stack[depth - 1].override != VEGA_BIDI_ON) t[i] = stack[depth - 1].override;
+ bool rtl = c == VEGA_BIDI_RLI || (c == VEGA_BIDI_FSI && first_strong(classes, match, i + 1, match[i]) == 1);
+ uint8_t next = rtl ? (uint8_t)((level + 1) | 1) : (uint8_t)((level + 2) & ~1);
+ if (next <= MAX_DEPTH && !overflow_isolates && !overflow_embeddings) {
+ ++valid_isolates;
+ stack[depth].level = next, stack[depth].override = VEGA_BIDI_ON, stack[depth++].isolate = true;
+ } else
+ ++overflow_isolates;
+ break;
+ }
+ case VEGA_BIDI_PDI:
+ if (overflow_isolates) --overflow_isolates;
+ else if (valid_isolates) {
+ overflow_embeddings = 0;
+ while (!stack[depth - 1].isolate) --depth;
+ --depth;
+ --valid_isolates;
+ }
+ levels[i] = stack[depth - 1].level;
+ if (stack[depth - 1].override != VEGA_BIDI_ON) t[i] = stack[depth - 1].override;
+ break;
+ case VEGA_BIDI_PDF:
+ levels[i] = level;
+ if (overflow_isolates) break;
+ if (overflow_embeddings) --overflow_embeddings;
+ else if (!stack[depth - 1].isolate && depth >= 2) --depth;
+ break;
+ case VEGA_BIDI_B: levels[i] = (uint8_t)paragraph; break; /* X8 */
+ case VEGA_BIDI_BN: levels[i] = level; break;
+ default:
+ levels[i] = level;
+ if (stack[depth - 1].override != VEGA_BIDI_ON) t[i] = stack[depth - 1].override;
+ }
+ }
+ /* X9, X10: level runs of the characters that stay, and the isolating run
+ * sequences they make (a run ending in an isolate initiator continues
+ * with the run its matching PDI begins), by the explicit levels (the
+ * sequences' own resolution changes levels). */
+ memcpy(embedding, levels, count);
+ size_t run_count = 0;
+ for (size_t i = 0; i < count; ++i) {
+ if (removed(classes[i])) continue;
+ bool starts = true;
+ for (size_t j = i; j-- > 0;)
+ if (!removed(classes[j])) { starts = embedding[j] != embedding[i]; break; }
+ if (starts) runs[run_count++] = i;
+ run_of[i] = run_count - 1;
+ }
+ for (size_t r = 0; r < run_count; ++r) {
+ size_t first = runs[r];
+ if (classes[first] == VEGA_BIDI_PDI && matched_pdi[first]) continue; /* it continues another sequence */
+ Sequence s = {classes, t, levels, codes, seq, 0, embedding[first], VEGA_BIDI_L, VEGA_BIDI_L, pairs};
+ for (size_t run = r;;) {
+ size_t last = runs[run];
+ for (size_t i = runs[run]; i < count && (removed(classes[i]) || run_of[i] == run); ++i)
+ if (!removed(classes[i])) seq[s.count++] = last = i;
+ if (!initiator(classes[last]) || match[last] >= count) break;
+ run = run_of[match[last]];
+ }
+ size_t head = seq[0], tail = seq[s.count - 1];
+ int previous = paragraph, next = paragraph;
+ for (size_t j = head; j-- > 0;)
+ if (!removed(classes[j])) { previous = embedding[j]; break; }
+ if (!initiator(classes[tail]))
+ for (size_t j = tail + 1; j < count; ++j)
+ if (!removed(classes[j])) { next = embedding[j]; break; }
+ s.sos = ((s.level > previous ? s.level : previous) & 1) ? VEGA_BIDI_R : VEGA_BIDI_L;
+ s.eos = ((s.level > next ? s.level : next) & 1) ? VEGA_BIDI_R : VEGA_BIDI_L;
+ weak_types(&s);
+ brackets(&s);
+ neutral_types(&s);
+ }
+ /* L1: separators, and whitespace and isolate controls before them or at
+ * the end of the line, go back to the paragraph's level. */
+ for (size_t i = count, trailing = 1; i-- > 0;) {
+ Class c = classes[i];
+ if (c == VEGA_BIDI_S || c == VEGA_BIDI_B) {
+ levels[i] = (uint8_t)paragraph;
+ trailing = 1;
+ } else if (c == VEGA_BIDI_WS || initiator(c) || c == VEGA_BIDI_PDI || removed(c)) {
+ if (trailing) levels[i] = (uint8_t)paragraph;
+ } else
+ trailing = 0;
+ }
+ for (size_t i = 0; i < count; ++i)
+ if (removed(classes[i])) levels[i] = VEGA_BIDI_REMOVED;
+done:
+ free(match);
+ free(runs);
+ free(run_of);
+ free(seq);
+ free(t);
+ free(matched_pdi);
+ free(pairs);
+ free(embedding);
+ return paragraph;
+}
+
+size_t vega_bidi_order(const uint8_t *levels, size_t count, uint32_t *order) {
+ size_t n = 0;
+ uint8_t highest = 0, lowest_odd = 0xff;
+ for (size_t i = 0; i < count; ++i) {
+ if (levels[i] == VEGA_BIDI_REMOVED) continue;
+ order[n++] = (uint32_t)i;
+ if (levels[i] > highest) highest = levels[i];
+ if ((levels[i] & 1) && levels[i] < lowest_odd) lowest_odd = levels[i];
+ }
+ /* L2: from the highest level down to the lowest odd one, reverse every
+ * run of characters at that level or higher. */
+ for (int level = highest; level >= lowest_odd && lowest_odd != 0xff; --level)
+ for (size_t k = 0; k < n;) {
+ if (levels[order[k]] < level) { ++k; continue; }
+ size_t end = k;
+ while (end < n && levels[order[end]] >= level) ++end;
+ for (size_t a = k, b = end - 1; a < b; ++a, --b) {
+ uint32_t swap = order[a];
+ order[a] = order[b];
+ order[b] = swap;
+ }
+ k = end;
+ }
+ return n;
+}
diff --git a/text/test-text.c b/text/test-text.c
new file mode 100644
index 0000000..e8077b5
--- /dev/null
+++ b/text/test-text.c
@@ -0,0 +1,139 @@
+/* Vega's text against Unicode's conformance tests (docs/design/004-text.md):
+ * test-text UCD-DIRECTORY
+ * BidiTest.txt (Bidi_Class sequences, each paragraph direction its bitset
+ * names) and BidiCharacterTest.txt (code points, paired brackets included):
+ * every line's levels and visual order. Prints one JSON line of counts;
+ * exits 1 on the first failures (up to ten shown). */
+#define _POSIX_C_SOURCE 200809L
+#include "text.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+enum { MAX = 512 };
+static unsigned failures;
+
+static void fail(const char *file, size_t line, const char *what) {
+ if (failures++ < 10) fprintf(stderr, "%s:%zu: %s\n", file, line, what);
+}
+
+static const char *const names[VEGA_BIDI_CLASSES] = {
+ "L", "R", "AL", "EN", "ES", "ET", "AN", "CS", "NSM", "BN", "B", "S", "WS", "ON",
+ "LRE", "LRO", "RLE", "RLO", "PDF", "LRI", "RLI", "FSI", "PDI"};
+
+static int class_named(const char *name) {
+ for (int c = 0; c < VEGA_BIDI_CLASSES; ++c)
+ if (!strcmp(names[c], name)) return c;
+ return -1;
+}
+
+/* Levels as the tests write them ("x" for removed), into levels; how many. */
+static size_t parse_levels(char *text, uint8_t *levels) {
+ size_t n = 0;
+ for (char *token = strtok(text, " \t\r\n"); token && n < MAX; token = strtok(NULL, " \t\r\n"))
+ levels[n++] = token[0] == 'x' ? VEGA_BIDI_REMOVED : (uint8_t)atoi(token);
+ return n;
+}
+
+static size_t parse_order(char *text, uint32_t *order) {
+ size_t n = 0;
+ for (char *token = strtok(text, " \t\r\n"); token && n < MAX; token = strtok(NULL, " \t\r\n"))
+ order[n++] = (uint32_t)strtoul(token, NULL, 10);
+ return n;
+}
+
+static bool same_result(const uint8_t *levels, const uint8_t *want, size_t count, const uint32_t *order,
+ size_t order_count) {
+ if (memcmp(levels, want, count)) return false;
+ uint32_t got[MAX];
+ return vega_bidi_order(levels, count, got) == order_count && !memcmp(got, order, order_count * sizeof(*got));
+}
+
+static size_t bidi_test(const char *path) {
+ FILE *in = fopen(path, "r");
+ if (!in) { perror(path); exit(2); }
+ char line[4096];
+ uint8_t want[MAX], levels[MAX];
+ uint32_t order[MAX];
+ size_t want_count = 0, order_count = 0, cases = 0, number = 0;
+ while (fgets(line, sizeof(line), in)) {
+ ++number;
+ if (line[0] == '#' || line[0] == '\n' || line[0] == '\r') continue;
+ if (!strncmp(line, "@Levels:", 8)) { want_count = parse_levels(line + 8, want); continue; }
+ if (!strncmp(line, "@Reorder:", 9)) { order_count = parse_order(line + 9, order); continue; }
+ if (line[0] == '@') continue;
+ char *semicolon = strchr(line, ';');
+ if (!semicolon) continue;
+ *semicolon = 0;
+ unsigned bitset = (unsigned)strtoul(semicolon + 1, NULL, 16);
+ VegaBidiClass classes[MAX];
+ size_t count = 0;
+ for (char *token = strtok(line, " \t"); token && count < MAX; token = strtok(NULL, " \t")) {
+ int c = class_named(token);
+ if (c < 0) { fail(path, number, "unknown class"); break; }
+ classes[count++] = (VegaBidiClass)c;
+ }
+ if (count != want_count) { fail(path, number, "levels of another length"); continue; }
+ static const int directions[3] = {VEGA_BIDI_AUTO, VEGA_BIDI_LTR, VEGA_BIDI_RTL};
+ for (unsigned d = 0; d < 3; ++d) {
+ if (!(bitset >> d & 1)) continue;
+ ++cases;
+ if (vega_bidi_levels(classes, NULL, count, directions[d], levels) < 0) { fail(path, number, "no memory"); continue; }
+ if (!same_result(levels, want, count, order, order_count)) {
+ char what[64];
+ snprintf(what, sizeof(what), "direction %u differs", d);
+ fail(path, number, what);
+ }
+ }
+ }
+ fclose(in);
+ return cases;
+}
+
+static size_t bidi_character_test(const char *path) {
+ FILE *in = fopen(path, "r");
+ if (!in) { perror(path); exit(2); }
+ char line[8192];
+ size_t cases = 0, number = 0;
+ while (fgets(line, sizeof(line), in)) {
+ ++number;
+ if (line[0] == '#' || line[0] == '\n' || line[0] == '\r') continue;
+ char *field[5];
+ field[0] = line;
+ for (unsigned f = 1; f < 5; ++f) {
+ field[f] = strchr(field[f - 1], ';');
+ if (!field[f]) break;
+ *field[f]++ = 0;
+ }
+ uint32_t codes[MAX], order[MAX];
+ VegaBidiClass classes[MAX];
+ uint8_t want[MAX], levels[MAX];
+ size_t count = 0;
+ for (char *token = strtok(field[0], " \t"); token && count < MAX; token = strtok(NULL, " \t")) {
+ codes[count] = (uint32_t)strtoul(token, NULL, 16);
+ classes[count] = vega_bidi_class(codes[count]);
+ ++count;
+ }
+ int direction = atoi(field[1]), paragraph = atoi(field[2]);
+ size_t want_count = parse_levels(field[3], want), order_count = parse_order(field[4], order);
+ ++cases;
+ int got = vega_bidi_levels(classes, codes, count, direction == 0 ? VEGA_BIDI_LTR : direction == 1 ? VEGA_BIDI_RTL : VEGA_BIDI_AUTO,
+ levels);
+ if (want_count != count) fail(path, number, "levels of another length");
+ else if (got != paragraph) fail(path, number, "paragraph level differs");
+ else if (!same_result(levels, want, count, order, order_count)) fail(path, number, "levels or order differ");
+ }
+ fclose(in);
+ return cases;
+}
+
+int main(int argc, char **argv) {
+ const char *ucd = argc > 1 ? argv[1] : "/usr/share/unicode";
+ char path[1024];
+ snprintf(path, sizeof(path), "%s/BidiTest.txt", ucd);
+ size_t bidi = bidi_test(path);
+ snprintf(path, sizeof(path), "%s/BidiCharacterTest.txt", ucd);
+ size_t characters = bidi_character_test(path);
+ printf("{\"bidi_test_cases\":%zu,\"bidi_character_test_cases\":%zu,\"failures\":%u}\n", bidi, characters, failures);
+ return failures ? 1 : 0;
+}
diff --git a/text/text.h b/text/text.h
new file mode 100644
index 0000000..e4e50ac
--- /dev/null
+++ b/text/text.h
@@ -0,0 +1,37 @@
+#ifndef VEGA_TEXT_H
+#define VEGA_TEXT_H
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/* Text as people write it (docs/design/004-text.md): the Unicode properties
+ * it needs (tables generated from the UCD by text/unicode.py) and the
+ * algorithms over them, checked against Unicode's conformance tests. */
+
+/* Bidi_Class (UAX #9), in the order of text/unicode.py. */
+typedef enum {
+ VEGA_BIDI_L, VEGA_BIDI_R, VEGA_BIDI_AL, VEGA_BIDI_EN, VEGA_BIDI_ES, VEGA_BIDI_ET, VEGA_BIDI_AN, VEGA_BIDI_CS,
+ VEGA_BIDI_NSM, VEGA_BIDI_BN, VEGA_BIDI_B, VEGA_BIDI_S, VEGA_BIDI_WS, VEGA_BIDI_ON, VEGA_BIDI_LRE, VEGA_BIDI_LRO,
+ VEGA_BIDI_RLE, VEGA_BIDI_RLO, VEGA_BIDI_PDF, VEGA_BIDI_LRI, VEGA_BIDI_RLI, VEGA_BIDI_FSI, VEGA_BIDI_PDI,
+ VEGA_BIDI_CLASSES
+} VegaBidiClass;
+VegaBidiClass vega_bidi_class(uint32_t code);
+/* A paired bracket: 1 opening, 2 closing (its pair in *pair), 0 none. */
+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);
+
+/* The embedding levels of one paragraph by the Unicode Bidirectional
+ * Algorithm (UAX #9, rules P2 to I2), then L1 as for one line: classes are
+ * its characters' Bidi_Class; codes, when given, are the characters, so
+ * that paired brackets resolve (rule N0); direction is VEGA_BIDI_AUTO (from
+ * its first strong character, P2-P3), VEGA_BIDI_LTR or VEGA_BIDI_RTL. Each
+ * character's level goes to levels, VEGA_BIDI_REMOVED for those rule X9
+ * removes (embedding controls and boundary neutrals). Returns the
+ * paragraph's level, or -1 without memory. */
+enum { VEGA_BIDI_AUTO = 0, VEGA_BIDI_LTR = 1, VEGA_BIDI_RTL = 2, VEGA_BIDI_REMOVED = 0xff };
+int vega_bidi_levels(const VegaBidiClass *classes, const uint32_t *codes, size_t count, int direction, uint8_t *levels);
+/* The visual order of one line (rule L2), left to right: the positions of
+ * its characters, those removed left out; returns how many. */
+size_t vega_bidi_order(const uint8_t *levels, size_t count, uint32_t *order);
+#endif
diff --git a/text/unicode-data.c b/text/unicode-data.c
new file mode 100644
index 0000000..00a2319
--- /dev/null
+++ b/text/unicode-data.c
@@ -0,0 +1,1775 @@
+/* Generated by text/unicode.py from the Unicode Character Database 15.1.0: do not edit. */
+#include "text.h"
+
+/* Bidi_Class (37632 bytes). */
+static const uint16_t bidi_blocks[4352] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 1, 1, 17, 18, 1, 19, 20, 21, 22, 23, 24, 25, 26, 1, 27,
+ 28, 29, 30, 31, 32, 33, 34, 33, 1, 33, 33, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 45, 1, 46, 47, 48, 49, 50, 51, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 52, 53, 54, 55, 56,
+ 1, 57, 58, 59, 1, 1, 1, 1, 60, 61, 62, 63, 60, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 1, 78, 79, 80, 81,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,0,13,13,13,13,0,13,13,0,0,0,0,0,0,0,0,0,0,13,0,13,13,13,0,0,0,0,0,13,13,
+ 13,13,13,13,0,13,0,13,0,13,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,13,13,0,0,0,0,
+ 13,13,13,13,13,0,0,0,0,0,13,13,13,13,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,13,13,13,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,4,5,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,13,13,13,13,13,13,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 12,13,13,13,13,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,0,0,0,0,0,0,0,0,0,8,8,8,8,0,0,13,0,0,0,0,0,13,13,0,0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,0,13,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,
+ 3,3,3,3,3,3,3,3,3,3,3,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,
+ 13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,
+ 13,13,13,13,13,13,0,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+ 13,13,13,13,13,13,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
+};
+
+VegaBidiClass vega_bidi_class(uint32_t code) {
+ return code > 0x10FFFF ? VEGA_BIDI_L : (VegaBidiClass)bidi_values[bidi_blocks[code >> 8] * 256u + (code & 255)];
+}
+
+/* Bidi_Paired_Bracket and Bidi_Paired_Bracket_Type (1 open, 2 close), by code point. */
+static const uint32_t brackets[128][3] = {
+ {0x0028, 0x0029, 1},
+ {0x0029, 0x0028, 2},
+ {0x005B, 0x005D, 1},
+ {0x005D, 0x005B, 2},
+ {0x007B, 0x007D, 1},
+ {0x007D, 0x007B, 2},
+ {0x0F3A, 0x0F3B, 1},
+ {0x0F3B, 0x0F3A, 2},
+ {0x0F3C, 0x0F3D, 1},
+ {0x0F3D, 0x0F3C, 2},
+ {0x169B, 0x169C, 1},
+ {0x169C, 0x169B, 2},
+ {0x2045, 0x2046, 1},
+ {0x2046, 0x2045, 2},
+ {0x207D, 0x207E, 1},
+ {0x207E, 0x207D, 2},
+ {0x208D, 0x208E, 1},
+ {0x208E, 0x208D, 2},
+ {0x2308, 0x2309, 1},
+ {0x2309, 0x2308, 2},
+ {0x230A, 0x230B, 1},
+ {0x230B, 0x230A, 2},
+ {0x2329, 0x232A, 1},
+ {0x232A, 0x2329, 2},
+ {0x2768, 0x2769, 1},
+ {0x2769, 0x2768, 2},
+ {0x276A, 0x276B, 1},
+ {0x276B, 0x276A, 2},
+ {0x276C, 0x276D, 1},
+ {0x276D, 0x276C, 2},
+ {0x276E, 0x276F, 1},
+ {0x276F, 0x276E, 2},
+ {0x2770, 0x2771, 1},
+ {0x2771, 0x2770, 2},
+ {0x2772, 0x2773, 1},
+ {0x2773, 0x2772, 2},
+ {0x2774, 0x2775, 1},
+ {0x2775, 0x2774, 2},
+ {0x27C5, 0x27C6, 1},
+ {0x27C6, 0x27C5, 2},
+ {0x27E6, 0x27E7, 1},
+ {0x27E7, 0x27E6, 2},
+ {0x27E8, 0x27E9, 1},
+ {0x27E9, 0x27E8, 2},
+ {0x27EA, 0x27EB, 1},
+ {0x27EB, 0x27EA, 2},
+ {0x27EC, 0x27ED, 1},
+ {0x27ED, 0x27EC, 2},
+ {0x27EE, 0x27EF, 1},
+ {0x27EF, 0x27EE, 2},
+ {0x2983, 0x2984, 1},
+ {0x2984, 0x2983, 2},
+ {0x2985, 0x2986, 1},
+ {0x2986, 0x2985, 2},
+ {0x2987, 0x2988, 1},
+ {0x2988, 0x2987, 2},
+ {0x2989, 0x298A, 1},
+ {0x298A, 0x2989, 2},
+ {0x298B, 0x298C, 1},
+ {0x298C, 0x298B, 2},
+ {0x298D, 0x2990, 1},
+ {0x298E, 0x298F, 2},
+ {0x298F, 0x298E, 1},
+ {0x2990, 0x298D, 2},
+ {0x2991, 0x2992, 1},
+ {0x2992, 0x2991, 2},
+ {0x2993, 0x2994, 1},
+ {0x2994, 0x2993, 2},
+ {0x2995, 0x2996, 1},
+ {0x2996, 0x2995, 2},
+ {0x2997, 0x2998, 1},
+ {0x2998, 0x2997, 2},
+ {0x29D8, 0x29D9, 1},
+ {0x29D9, 0x29D8, 2},
+ {0x29DA, 0x29DB, 1},
+ {0x29DB, 0x29DA, 2},
+ {0x29FC, 0x29FD, 1},
+ {0x29FD, 0x29FC, 2},
+ {0x2E22, 0x2E23, 1},
+ {0x2E23, 0x2E22, 2},
+ {0x2E24, 0x2E25, 1},
+ {0x2E25, 0x2E24, 2},
+ {0x2E26, 0x2E27, 1},
+ {0x2E27, 0x2E26, 2},
+ {0x2E28, 0x2E29, 1},
+ {0x2E29, 0x2E28, 2},
+ {0x2E55, 0x2E56, 1},
+ {0x2E56, 0x2E55, 2},
+ {0x2E57, 0x2E58, 1},
+ {0x2E58, 0x2E57, 2},
+ {0x2E59, 0x2E5A, 1},
+ {0x2E5A, 0x2E59, 2},
+ {0x2E5B, 0x2E5C, 1},
+ {0x2E5C, 0x2E5B, 2},
+ {0x3008, 0x3009, 1},
+ {0x3009, 0x3008, 2},
+ {0x300A, 0x300B, 1},
+ {0x300B, 0x300A, 2},
+ {0x300C, 0x300D, 1},
+ {0x300D, 0x300C, 2},
+ {0x300E, 0x300F, 1},
+ {0x300F, 0x300E, 2},
+ {0x3010, 0x3011, 1},
+ {0x3011, 0x3010, 2},
+ {0x3014, 0x3015, 1},
+ {0x3015, 0x3014, 2},
+ {0x3016, 0x3017, 1},
+ {0x3017, 0x3016, 2},
+ {0x3018, 0x3019, 1},
+ {0x3019, 0x3018, 2},
+ {0x301A, 0x301B, 1},
+ {0x301B, 0x301A, 2},
+ {0xFE59, 0xFE5A, 1},
+ {0xFE5A, 0xFE59, 2},
+ {0xFE5B, 0xFE5C, 1},
+ {0xFE5C, 0xFE5B, 2},
+ {0xFE5D, 0xFE5E, 1},
+ {0xFE5E, 0xFE5D, 2},
+ {0xFF08, 0xFF09, 1},
+ {0xFF09, 0xFF08, 2},
+ {0xFF3B, 0xFF3D, 1},
+ {0xFF3D, 0xFF3B, 2},
+ {0xFF5B, 0xFF5D, 1},
+ {0xFF5D, 0xFF5B, 2},
+ {0xFF5F, 0xFF60, 1},
+ {0xFF60, 0xFF5F, 2},
+ {0xFF62, 0xFF63, 1},
+ {0xFF63, 0xFF62, 2},
+};
+
+/* Bidi_Mirroring_Glyph, by code point. */
+static const uint32_t mirrors[428][2] = {
+ {0x0028, 0x0029},
+ {0x0029, 0x0028},
+ {0x003C, 0x003E},
+ {0x003E, 0x003C},
+ {0x005B, 0x005D},
+ {0x005D, 0x005B},
+ {0x007B, 0x007D},
+ {0x007D, 0x007B},
+ {0x00AB, 0x00BB},
+ {0x00BB, 0x00AB},
+ {0x0F3A, 0x0F3B},
+ {0x0F3B, 0x0F3A},
+ {0x0F3C, 0x0F3D},
+ {0x0F3D, 0x0F3C},
+ {0x169B, 0x169C},
+ {0x169C, 0x169B},
+ {0x2039, 0x203A},
+ {0x203A, 0x2039},
+ {0x2045, 0x2046},
+ {0x2046, 0x2045},
+ {0x207D, 0x207E},
+ {0x207E, 0x207D},
+ {0x208D, 0x208E},
+ {0x208E, 0x208D},
+ {0x2208, 0x220B},
+ {0x2209, 0x220C},
+ {0x220A, 0x220D},
+ {0x220B, 0x2208},
+ {0x220C, 0x2209},
+ {0x220D, 0x220A},
+ {0x2215, 0x29F5},
+ {0x221F, 0x2BFE},
+ {0x2220, 0x29A3},
+ {0x2221, 0x299B},
+ {0x2222, 0x29A0},
+ {0x2224, 0x2AEE},
+ {0x223C, 0x223D},
+ {0x223D, 0x223C},
+ {0x2243, 0x22CD},
+ {0x2245, 0x224C},
+ {0x224C, 0x2245},
+ {0x2252, 0x2253},
+ {0x2253, 0x2252},
+ {0x2254, 0x2255},
+ {0x2255, 0x2254},
+ {0x2264, 0x2265},
+ {0x2265, 0x2264},
+ {0x2266, 0x2267},
+ {0x2267, 0x2266},
+ {0x2268, 0x2269},
+ {0x2269, 0x2268},
+ {0x226A, 0x226B},
+ {0x226B, 0x226A},
+ {0x226E, 0x226F},
+ {0x226F, 0x226E},
+ {0x2270, 0x2271},
+ {0x2271, 0x2270},
+ {0x2272, 0x2273},
+ {0x2273, 0x2272},
+ {0x2274, 0x2275},
+ {0x2275, 0x2274},
+ {0x2276, 0x2277},
+ {0x2277, 0x2276},
+ {0x2278, 0x2279},
+ {0x2279, 0x2278},
+ {0x227A, 0x227B},
+ {0x227B, 0x227A},
+ {0x227C, 0x227D},
+ {0x227D, 0x227C},
+ {0x227E, 0x227F},
+ {0x227F, 0x227E},
+ {0x2280, 0x2281},
+ {0x2281, 0x2280},
+ {0x2282, 0x2283},
+ {0x2283, 0x2282},
+ {0x2284, 0x2285},
+ {0x2285, 0x2284},
+ {0x2286, 0x2287},
+ {0x2287, 0x2286},
+ {0x2288, 0x2289},
+ {0x2289, 0x2288},
+ {0x228A, 0x228B},
+ {0x228B, 0x228A},
+ {0x228F, 0x2290},
+ {0x2290, 0x228F},
+ {0x2291, 0x2292},
+ {0x2292, 0x2291},
+ {0x2298, 0x29B8},
+ {0x22A2, 0x22A3},
+ {0x22A3, 0x22A2},
+ {0x22A6, 0x2ADE},
+ {0x22A8, 0x2AE4},
+ {0x22A9, 0x2AE3},
+ {0x22AB, 0x2AE5},
+ {0x22B0, 0x22B1},
+ {0x22B1, 0x22B0},
+ {0x22B2, 0x22B3},
+ {0x22B3, 0x22B2},
+ {0x22B4, 0x22B5},
+ {0x22B5, 0x22B4},
+ {0x22B6, 0x22B7},
+ {0x22B7, 0x22B6},
+ {0x22B8, 0x27DC},
+ {0x22C9, 0x22CA},
+ {0x22CA, 0x22C9},
+ {0x22CB, 0x22CC},
+ {0x22CC, 0x22CB},
+ {0x22CD, 0x2243},
+ {0x22D0, 0x22D1},
+ {0x22D1, 0x22D0},
+ {0x22D6, 0x22D7},
+ {0x22D7, 0x22D6},
+ {0x22D8, 0x22D9},
+ {0x22D9, 0x22D8},
+ {0x22DA, 0x22DB},
+ {0x22DB, 0x22DA},
+ {0x22DC, 0x22DD},
+ {0x22DD, 0x22DC},
+ {0x22DE, 0x22DF},
+ {0x22DF, 0x22DE},
+ {0x22E0, 0x22E1},
+ {0x22E1, 0x22E0},
+ {0x22E2, 0x22E3},
+ {0x22E3, 0x22E2},
+ {0x22E4, 0x22E5},
+ {0x22E5, 0x22E4},
+ {0x22E6, 0x22E7},
+ {0x22E7, 0x22E6},
+ {0x22E8, 0x22E9},
+ {0x22E9, 0x22E8},
+ {0x22EA, 0x22EB},
+ {0x22EB, 0x22EA},
+ {0x22EC, 0x22ED},
+ {0x22ED, 0x22EC},
+ {0x22F0, 0x22F1},
+ {0x22F1, 0x22F0},
+ {0x22F2, 0x22FA},
+ {0x22F3, 0x22FB},
+ {0x22F4, 0x22FC},
+ {0x22F6, 0x22FD},
+ {0x22F7, 0x22FE},
+ {0x22FA, 0x22F2},
+ {0x22FB, 0x22F3},
+ {0x22FC, 0x22F4},
+ {0x22FD, 0x22F6},
+ {0x22FE, 0x22F7},
+ {0x2308, 0x2309},
+ {0x2309, 0x2308},
+ {0x230A, 0x230B},
+ {0x230B, 0x230A},
+ {0x2329, 0x232A},
+ {0x232A, 0x2329},
+ {0x2768, 0x2769},
+ {0x2769, 0x2768},
+ {0x276A, 0x276B},
+ {0x276B, 0x276A},
+ {0x276C, 0x276D},
+ {0x276D, 0x276C},
+ {0x276E, 0x276F},
+ {0x276F, 0x276E},
+ {0x2770, 0x2771},
+ {0x2771, 0x2770},
+ {0x2772, 0x2773},
+ {0x2773, 0x2772},
+ {0x2774, 0x2775},
+ {0x2775, 0x2774},
+ {0x27C3, 0x27C4},
+ {0x27C4, 0x27C3},
+ {0x27C5, 0x27C6},
+ {0x27C6, 0x27C5},
+ {0x27C8, 0x27C9},
+ {0x27C9, 0x27C8},
+ {0x27CB, 0x27CD},
+ {0x27CD, 0x27CB},
+ {0x27D5, 0x27D6},
+ {0x27D6, 0x27D5},
+ {0x27DC, 0x22B8},
+ {0x27DD, 0x27DE},
+ {0x27DE, 0x27DD},
+ {0x27E2, 0x27E3},
+ {0x27E3, 0x27E2},
+ {0x27E4, 0x27E5},
+ {0x27E5, 0x27E4},
+ {0x27E6, 0x27E7},
+ {0x27E7, 0x27E6},
+ {0x27E8, 0x27E9},
+ {0x27E9, 0x27E8},
+ {0x27EA, 0x27EB},
+ {0x27EB, 0x27EA},
+ {0x27EC, 0x27ED},
+ {0x27ED, 0x27EC},
+ {0x27EE, 0x27EF},
+ {0x27EF, 0x27EE},
+ {0x2983, 0x2984},
+ {0x2984, 0x2983},
+ {0x2985, 0x2986},
+ {0x2986, 0x2985},
+ {0x2987, 0x2988},
+ {0x2988, 0x2987},
+ {0x2989, 0x298A},
+ {0x298A, 0x2989},
+ {0x298B, 0x298C},
+ {0x298C, 0x298B},
+ {0x298D, 0x2990},
+ {0x298E, 0x298F},
+ {0x298F, 0x298E},
+ {0x2990, 0x298D},
+ {0x2991, 0x2992},
+ {0x2992, 0x2991},
+ {0x2993, 0x2994},
+ {0x2994, 0x2993},
+ {0x2995, 0x2996},
+ {0x2996, 0x2995},
+ {0x2997, 0x2998},
+ {0x2998, 0x2997},
+ {0x299B, 0x2221},
+ {0x29A0, 0x2222},
+ {0x29A3, 0x2220},
+ {0x29A4, 0x29A5},
+ {0x29A5, 0x29A4},
+ {0x29A8, 0x29A9},
+ {0x29A9, 0x29A8},
+ {0x29AA, 0x29AB},
+ {0x29AB, 0x29AA},
+ {0x29AC, 0x29AD},
+ {0x29AD, 0x29AC},
+ {0x29AE, 0x29AF},
+ {0x29AF, 0x29AE},
+ {0x29B8, 0x2298},
+ {0x29C0, 0x29C1},
+ {0x29C1, 0x29C0},
+ {0x29C4, 0x29C5},
+ {0x29C5, 0x29C4},
+ {0x29CF, 0x29D0},
+ {0x29D0, 0x29CF},
+ {0x29D1, 0x29D2},
+ {0x29D2, 0x29D1},
+ {0x29D4, 0x29D5},
+ {0x29D5, 0x29D4},
+ {0x29D8, 0x29D9},
+ {0x29D9, 0x29D8},
+ {0x29DA, 0x29DB},
+ {0x29DB, 0x29DA},
+ {0x29E8, 0x29E9},
+ {0x29E9, 0x29E8},
+ {0x29F5, 0x2215},
+ {0x29F8, 0x29F9},
+ {0x29F9, 0x29F8},
+ {0x29FC, 0x29FD},
+ {0x29FD, 0x29FC},
+ {0x2A2B, 0x2A2C},
+ {0x2A2C, 0x2A2B},
+ {0x2A2D, 0x2A2E},
+ {0x2A2E, 0x2A2D},
+ {0x2A34, 0x2A35},
+ {0x2A35, 0x2A34},
+ {0x2A3C, 0x2A3D},
+ {0x2A3D, 0x2A3C},
+ {0x2A64, 0x2A65},
+ {0x2A65, 0x2A64},
+ {0x2A79, 0x2A7A},
+ {0x2A7A, 0x2A79},
+ {0x2A7B, 0x2A7C},
+ {0x2A7C, 0x2A7B},
+ {0x2A7D, 0x2A7E},
+ {0x2A7E, 0x2A7D},
+ {0x2A7F, 0x2A80},
+ {0x2A80, 0x2A7F},
+ {0x2A81, 0x2A82},
+ {0x2A82, 0x2A81},
+ {0x2A83, 0x2A84},
+ {0x2A84, 0x2A83},
+ {0x2A85, 0x2A86},
+ {0x2A86, 0x2A85},
+ {0x2A87, 0x2A88},
+ {0x2A88, 0x2A87},
+ {0x2A89, 0x2A8A},
+ {0x2A8A, 0x2A89},
+ {0x2A8B, 0x2A8C},
+ {0x2A8C, 0x2A8B},
+ {0x2A8D, 0x2A8E},
+ {0x2A8E, 0x2A8D},
+ {0x2A8F, 0x2A90},
+ {0x2A90, 0x2A8F},
+ {0x2A91, 0x2A92},
+ {0x2A92, 0x2A91},
+ {0x2A93, 0x2A94},
+ {0x2A94, 0x2A93},
+ {0x2A95, 0x2A96},
+ {0x2A96, 0x2A95},
+ {0x2A97, 0x2A98},
+ {0x2A98, 0x2A97},
+ {0x2A99, 0x2A9A},
+ {0x2A9A, 0x2A99},
+ {0x2A9B, 0x2A9C},
+ {0x2A9C, 0x2A9B},
+ {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 {0x2ADE, 0x22A6},
+ {0x2AE3, 0x22A9},
+ {0x2AE4, 0x22A8},
+ {0x2AE5, 0x22AB},
+ {0x2AEC, 0x2AED},
+ {0x2AED, 0x2AEC},
+ {0x2AEE, 0x2224},
+ {0x2AF7, 0x2AF8},
+ {0x2AF8, 0x2AF7},
+ {0x2AF9, 0x2AFA},
+ {0x2AFA, 0x2AF9},
+ {0x2BFE, 0x221F},
+ {0x2E02, 0x2E03},
+ {0x2E03, 0x2E02},
+ {0x2E04, 0x2E05},
+ {0x2E05, 0x2E04},
+ {0x2E09, 0x2E0A},
+ {0x2E0A, 0x2E09},
+ {0x2E0C, 0x2E0D},
+ {0x2E0D, 0x2E0C},
+ {0x2E1C, 0x2E1D},
+ {0x2E1D, 0x2E1C},
+ {0x2E20, 0x2E21},
+ {0x2E21, 0x2E20},
+ {0x2E22, 0x2E23},
+ {0x2E23, 0x2E22},
+ {0x2E24, 0x2E25},
+ {0x2E25, 0x2E24},
+ {0x2E26, 0x2E27},
+ {0x2E27, 0x2E26},
+ {0x2E28, 0x2E29},
+ {0x2E29, 0x2E28},
+ {0x2E55, 0x2E56},
+ {0x2E56, 0x2E55},
+ {0x2E57, 0x2E58},
+ {0x2E58, 0x2E57},
+ {0x2E59, 0x2E5A},
+ {0x2E5A, 0x2E59},
+ {0x2E5B, 0x2E5C},
+ {0x2E5C, 0x2E5B},
+ {0x3008, 0x3009},
+ {0x3009, 0x3008},
+ {0x300A, 0x300B},
+ {0x300B, 0x300A},
+ {0x300C, 0x300D},
+ {0x300D, 0x300C},
+ {0x300E, 0x300F},
+ {0x300F, 0x300E},
+ {0x3010, 0x3011},
+ {0x3011, 0x3010},
+ {0x3014, 0x3015},
+ {0x3015, 0x3014},
+ {0x3016, 0x3017},
+ {0x3017, 0x3016},
+ {0x3018, 0x3019},
+ {0x3019, 0x3018},
+ {0x301A, 0x301B},
+ {0x301B, 0x301A},
+ {0xFE59, 0xFE5A},
+ {0xFE5A, 0xFE59},
+ {0xFE5B, 0xFE5C},
+ {0xFE5C, 0xFE5B},
+ {0xFE5D, 0xFE5E},
+ {0xFE5E, 0xFE5D},
+ {0xFE64, 0xFE65},
+ {0xFE65, 0xFE64},
+ {0xFF08, 0xFF09},
+ {0xFF09, 0xFF08},
+ {0xFF1C, 0xFF1E},
+ {0xFF1E, 0xFF1C},
+ {0xFF3B, 0xFF3D},
+ {0xFF3D, 0xFF3B},
+ {0xFF5B, 0xFF5D},
+ {0xFF5D, 0xFF5B},
+ {0xFF5F, 0xFF60},
+ {0xFF60, 0xFF5F},
+ {0xFF62, 0xFF63},
+ {0xFF63, 0xFF62},
+};
+
+/* The row of a sorted table of rows whose first value is code, or -1. */
+static long find(const uint32_t *rows, size_t count, size_t width, uint32_t code) {
+ size_t low = 0, high = count;
+ while (low < high) {
+ size_t middle = (low + high) / 2;
+ if (rows[middle * width] < code) low = middle + 1;
+ else high = middle;
+ }
+ return low < count && rows[low * width] == code ? (long)low : -1;
+}
+
+int vega_bracket(uint32_t code, uint32_t *pair) {
+ long row = find(&brackets[0][0], sizeof(brackets) / sizeof(*brackets), 3, code);
+ if (row < 0) return 0;
+ *pair = brackets[row][1];
+ return (int)brackets[row][2];
+}
+
+uint32_t vega_mirror(uint32_t code) {
+ long row = find(&mirrors[0][0], sizeof(mirrors) / sizeof(*mirrors), 2, code);
+ return row < 0 ? 0 : mirrors[row][1];
+}
diff --git a/text/unicode.py b/text/unicode.py
new file mode 100644
index 0000000..ac0abaf
--- /dev/null
+++ b/text/unicode.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python3
+"""The Unicode properties Vega's text needs, as C tables (text/unicode-data.c),
+from the Unicode Character Database (15.1 on Debian: /usr/share/unicode).
+
+ python3 text/unicode.py [UCD directory] > text/unicode-data.c
+
+A property of every code point is a two-stage table: the code point's upper
+bits pick a block of 256 values (blocks that repeat are kept once). Sparse
+properties (paired brackets, mirrors) are sorted arrays, searched by code
+point. The output is deterministic: the same UCD gives the same file.
+"""
+import re
+import sys
+from pathlib import Path
+
+UCD = Path(sys.argv[1] if len(sys.argv) > 1 else '/usr/share/unicode')
+
+BIDI = ['L', 'R', 'AL', 'EN', 'ES', 'ET', 'AN', 'CS', 'NSM', 'BN', 'B', 'S', 'WS', 'ON',
+ 'LRE', 'LRO', 'RLE', 'RLO', 'PDF', 'LRI', 'RLI', 'FSI', 'PDI']
+LONG = {'Left_To_Right': 'L', 'Right_To_Left': 'R', 'Arabic_Letter': 'AL', 'European_Number': 'EN',
+ 'European_Separator': 'ES', 'European_Terminator': 'ET', 'Arabic_Number': 'AN', 'Common_Separator': 'CS',
+ 'Nonspacing_Mark': 'NSM', 'Boundary_Neutral': 'BN', 'Paragraph_Separator': 'B', 'Segment_Separator': 'S',
+ 'White_Space': 'WS', 'Other_Neutral': 'ON', 'Left_To_Right_Embedding': 'LRE',
+ 'Left_To_Right_Override': 'LRO', 'Right_To_Left_Embedding': 'RLE', 'Right_To_Left_Override': 'RLO',
+ 'Pop_Directional_Format': 'PDF', 'Left_To_Right_Isolate': 'LRI', 'Right_To_Left_Isolate': 'RLI',
+ 'First_Strong_Isolate': 'FSI', 'Pop_Directional_Isolate': 'PDI'}
+LAST = 0x10FFFF
+
+
+def ranges(path):
+ """(first, last, value, missing) of each line of a UCD file, @missing lines included."""
+ for line in (UCD / path).read_text(encoding='utf-8').splitlines():
+ missing = line.startswith('# @missing:')
+ body = line[len('# @missing:'):] if missing else line.split('#', 1)[0]
+ if not body.strip():
+ continue
+ fields = [f.strip() for f in body.split(';')]
+ span = fields[0].split('..')
+ yield int(span[0], 16), int(span[-1], 16), fields[1:], missing
+
+
+def derived(path, names, long_names=None):
+ """A value for every code point: the defaults of the @missing lines, then the data."""
+ values = [0] * (LAST + 1)
+ lines = list(ranges(path))
+ for first, last, fields, missing in lines:
+ if missing:
+ name = (long_names or {}).get(fields[0], fields[0])
+ values[first:last + 1] = [names.index(name)] * (last - first + 1)
+ for first, last, fields, missing in lines:
+ if not missing:
+ values[first:last + 1] = [names.index(fields[0])] * (last - first + 1)
+ return values
+
+
+def two_stage(name, values):
+ """C for a two-stage table of u8 values, and the lookup's name."""
+ blocks, index, stage1 = [], {}, []
+ for start in range(0, LAST + 1, 256):
+ block = tuple(values[start:start + 256])
+ if block not in index:
+ index[block] = len(blocks)
+ blocks.append(block)
+ stage1.append(index[block])
+ out = [f'static const uint16_t {name}_blocks[{len(stage1)}] = {{']
+ for i in range(0, len(stage1), 16):
+ out.append(' ' + ', '.join(str(v) for v in stage1[i:i + 16]) + ',')
+ out.append('};')
+ out.append(f'static const uint8_t {name}_values[{len(blocks) * 256}] = {{')
+ for block in blocks:
+ for i in range(0, 256, 32):
+ out.append(' ' + ','.join(str(v) for v in block[i:i + 32]) + ',')
+ out.append('};')
+ return '\n'.join(out), len(stage1) * 2 + len(blocks) * 256
+
+
+def main():
+ bidi = derived('extracted/DerivedBidiClass.txt', BIDI, LONG)
+ table, size = two_stage('bidi', bidi)
+ brackets = []
+ for first, _, fields, missing in ranges('BidiBrackets.txt'):
+ if not missing:
+ brackets.append((first, int(fields[0], 16), 1 if fields[1] == 'o' else 2))
+ mirrors = [(first, int(fields[0], 16)) for first, _, fields, missing in ranges('BidiMirroring.txt') if not missing]
+ version = re.search(r'(\d+\.\d+\.\d+)', (UCD / 'ReadMe.txt').read_text()) if (UCD / 'ReadMe.txt').exists() else None
+ print('/* Generated by text/unicode.py from the Unicode Character Database'
+ f'{" " + version.group(1) if version else ""}: do not edit. */')
+ print('#include "text.h"')
+ print()
+ print(f'/* Bidi_Class ({size} bytes). */')
+ print(table)
+ print()
+ print('VegaBidiClass vega_bidi_class(uint32_t code) {')
+ print(' return code > 0x10FFFF ? VEGA_BIDI_L : (VegaBidiClass)bidi_values[bidi_blocks[code >> 8] * 256u + (code & 255)];')
+ print('}')
+ print()
+ print(f'/* Bidi_Paired_Bracket and Bidi_Paired_Bracket_Type (1 open, 2 close), by code point. */')
+ print(f'static const uint32_t brackets[{len(brackets)}][3] = {{')
+ for code, pair, kind in sorted(brackets):
+ print(f' {{0x{code:04X}, 0x{pair:04X}, {kind}}},')
+ print('};')
+ print()
+ print(f'/* Bidi_Mirroring_Glyph, by code point. */')
+ print(f'static const uint32_t mirrors[{len(mirrors)}][2] = {{')
+ for code, mirror in sorted(mirrors):
+ print(f' {{0x{code:04X}, 0x{mirror:04X}}},')
+ print('};')
+ print('''
+/* The row of a sorted table of rows whose first value is code, or -1. */
+static long find(const uint32_t *rows, size_t count, size_t width, uint32_t code) {
+ size_t low = 0, high = count;
+ while (low < high) {
+ size_t middle = (low + high) / 2;
+ if (rows[middle * width] < code) low = middle + 1;
+ else high = middle;
+ }
+ return low < count && rows[low * width] == code ? (long)low : -1;
+}
+
+int vega_bracket(uint32_t code, uint32_t *pair) {
+ long row = find(&brackets[0][0], sizeof(brackets) / sizeof(*brackets), 3, code);
+ if (row < 0) return 0;
+ *pair = brackets[row][1];
+ return (int)brackets[row][2];
+}
+
+uint32_t vega_mirror(uint32_t code) {
+ long row = find(&mirrors[0][0], sizeof(mirrors) / sizeof(*mirrors), 2, code);
+ return row < 0 ? 0 : mirrors[row][1];
+}''')
+
+
+if __name__ == '__main__':
+ main()