From ef8a2910aa4bfc49973e63e1003b01f47a675249 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 26 Apr 2024 17:20:26 +0200 Subject: Fully comply with Unicode 15.1 § 3.13 in u8lower() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/unicode/prop/uprop_get_lc.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'lib/unicode/prop') diff --git a/lib/unicode/prop/uprop_get_lc.c b/lib/unicode/prop/uprop_get_lc.c index 0ce1072..752ed71 100644 --- a/lib/unicode/prop/uprop_get_lc.c +++ b/lib/unicode/prop/uprop_get_lc.c @@ -8,35 +8,40 @@ struct rview uprop_get_lc(rune ch, struct lcctx ctx) { + constexpr rune COMB_GRAVE = 0x300; + constexpr rune COMB_ACUTE = 0x301; + constexpr rune COMB_TILDE = 0x303; + constexpr rune COMB_DOT_ABOVE = 0x307; + if (ch == U'Σ') - return ctx.eow ? M(U'ς') : M(U'σ'); + return ctx.final_sigma ? M(U'ς') : M(U'σ'); if (ch == U'İ') - return ctx.az_or_tr ? M('i') : M('i', 0x307); + return ctx.az_or_tr ? M('i') : M('i', COMB_DOT_ABOVE); if (ctx.lt) { - if (ctx.before_acc) { + if (ctx.more_above) { switch (ch) { case 'I': - return M('i', 0x307); + return M('i', COMB_DOT_ABOVE); case 'J': - return M('j', 0x307); + return M('j', COMB_DOT_ABOVE); case U'Į': - return M(U'į', 0x307); + return M(U'į', COMB_DOT_ABOVE); } } switch (ch) { case U'Ì': - return M('i', 0x307, 0x300); + return M('i', COMB_DOT_ABOVE, COMB_GRAVE); case U'Í': - return M('i', 0x307, 0x301); + return M('i', COMB_DOT_ABOVE, COMB_ACUTE); case U'Ĩ': - return M('i', 0x307, 0x303); + return M('i', COMB_DOT_ABOVE, COMB_TILDE); } } if (ctx.az_or_tr) { - if (ch == 0x307 && ctx.after_I) + if (ch == COMB_DOT_ABOVE && ctx.after_I) return M(); if (ch == 'I' && !ctx.before_dot) return M(U'ı'); -- cgit v1.2.3