mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibUnicode: Fix Hangul syllable composition for specific cases
This fixes `combine_hangul_code_points` which would try to combine a LVT syllable with a trailing consonant, resulting in a wrong character. Also added a test for this specific case.
This commit is contained in:
parent
ce0e4b71a3
commit
104b51b912
Notes:
sideshowbarker
2024-07-17 06:11:17 +09:00
Author: https://github.com/matcool
Commit: 104b51b912
Pull-request: https://github.com/SerenityOS/serenity/pull/15498
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 3 additions and 1 deletions
|
@ -111,7 +111,8 @@ static u32 combine_hangul_code_points(u32 a, u32 b)
|
|||
auto const leading_vowel_index = leading_index * HANGUL_BLOCK_COUNT + vowel_index * HANGUL_TRAILING_COUNT;
|
||||
return HANGUL_SYLLABLE_BASE + leading_vowel_index;
|
||||
}
|
||||
if (is_hangul_code_point(a) && is_hangul_trailing(b)) {
|
||||
// LV characters are the first in each "T block", so use this check to avoid combining LVT with T.
|
||||
if (is_hangul_code_point(a) && (a - HANGUL_SYLLABLE_BASE) % HANGUL_TRAILING_COUNT == 0 && is_hangul_trailing(b)) {
|
||||
return a + b - HANGUL_TRAILING_BASE;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue