diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-26 22:22:27 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-26 22:22:27 +0200 |
commit | fa95265eaa8c1d7f41dc537f44450b142247253e (patch) | |
tree | 2067d7dba7497c7c58738fba3a204fc8bd6a5e11 | |
parent | ef8a2910aa4bfc49973e63e1003b01f47a675249 (diff) |
Only compute before_dot or more_above for AZ/TR/LT
-rw-r--r-- | lib/unicode/string/u8lower.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/unicode/string/u8lower.c b/lib/unicode/string/u8lower.c index f9ac78c..f59cf39 100644 --- a/lib/unicode/string/u8lower.c +++ b/lib/unicode/string/u8lower.c @@ -35,23 +35,25 @@ u8lower(char8_t *restrict dst, size_t dstn, const char8_t *src, size_t srcn, if (srcn > 0) u8tor(&next, src); - if (before_dot_cnt == 0 || more_above_cnt == 0) { - rune ch = 0; - before_dot_cnt = more_above_cnt = 0; - struct u8view cpy = {src, srcn}; - - do { - before_dot_cnt++; - more_above_cnt++; - } while (u8next(&ch ,U8_ARGSP(cpy)) && !uprop_ccc_0_or_230(ch)); - - if (ch != COMB_DOT_ABOVE) - before_dot_cnt = 0; - if (uprop_get_ccc(ch) != 230) - more_above_cnt = 0; - } else { - before_dot_cnt--; - more_above_cnt--; + if (ctx.az_or_tr || ctx.lt) { + if (before_dot_cnt == 0 || more_above_cnt == 0) { + rune ch = 0; + before_dot_cnt = more_above_cnt = 0; + struct u8view cpy = {src, srcn}; + + do { + before_dot_cnt++; + more_above_cnt++; + } while (u8next(&ch, U8_ARGSP(cpy)) && !uprop_ccc_0_or_230(ch)); + + if (ch != COMB_DOT_ABOVE) + before_dot_cnt = 0; + if (uprop_get_ccc(ch) != 230) + more_above_cnt = 0; + } else { + before_dot_cnt--; + more_above_cnt--; + } } if (final_sigma.after == 0) { |