From 80350b43c77a7835546a8c29e0d93eeb3cddfadd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 24 Jan 2026 21:10:12 +0100 Subject: Add superscript and subscript (so far only with digits) and lycian and lydian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libcharconv_latin.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libcharconv_latin.c') diff --git a/libcharconv_latin.c b/libcharconv_latin.c index d3c1817..60a2fb5 100644 --- a/libcharconv_latin.c +++ b/libcharconv_latin.c @@ -299,6 +299,34 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz goto conv3; } + } else if (UINT32_C(0x2070) <= c && c <= UINT32_C(0x2079)) { + /* superscript */ + c -= (uint_least32_t)UINT32_C(0x2070) - (uint_least32_t)'0'; + goto conv; + } else if (UINT32_C(0x00B2) <= c && c <= UINT32_C(0x00B3)) { + /* superscript */ + c -= (uint_least32_t)UINT32_C(0x00B2) - (uint_least32_t)'2'; + goto conv; + } else if (c == UINT32_C(0x00B9)) { + /* superscript */ + c -= (uint_least32_t)UINT32_C(0x00B9) - (uint_least32_t)'1'; + goto conv; + + } else if (UINT32_C(0x2080) <= c && c <= UINT32_C(0x2089)) { + /* subscript */ + c -= (uint_least32_t)UINT32_C(0x2080) - (uint_least32_t)'0'; + goto conv; + + } else if (UINT32_C(0x10920) <= c && c <= UINT32_C(0x10939)) { + /* lydian */ + c = (uint_least32_t)"abgdeviyklmnorStufqsTAELNc"[c - UINT32_C(0x10920)]; + goto conv; + + } else if (UINT32_C(0x10280) <= c && c <= UINT32_C(0x1029C)) { + /* lycian */ + c = (uint_least32_t)"aebBgdiwzDjkqlmnMNupKrstTAEhx"[c - UINT32_C(0x10280)]; + goto conv; + } else { switch (c) { /* shogi */ @@ -428,6 +456,9 @@ libcharconv_latin(const char *s, size_t slen, size_t *n, uint_least32_t *cp, siz c = (uint_least32_t)'?'; goto conv; + /* lydian */ + case UINT32_C(0x1093F): c = (uint_least32_t)'"'; goto conv; + default: no_match: *n += clen; -- cgit v1.2.3-70-g09d2