From 6952780c1f08c4985c14ced07ecd8cb6d80f752c Mon Sep 17 00:00:00 2001 From: imachus <51533227+imachus@users.noreply.github.com> Date: Thu, 8 Oct 2026 10:20:44 +0900 Subject: [PATCH] =?UTF-8?q?Type:=20no=20Japanese=E2=80=93Latin=20space=20n?= =?UTF-8?q?ext=20to=20Hangul=20compatibility=20or=20half-width=20jamo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #370: Hangul Compatibility Jamo (U+3130–318F, ㄱ ㅏ) and half-width Hangul (U+FFA0–FFDC) counted as Japanese letters, so a Latin letter next to them took the quarter em. They are left out like Hangul syllables; the test covers both. Co-Authored-By: Claude Opus 5.5 --- crates/text/src/layout.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index a7bbeed0..d8794230 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -281,7 +281,10 @@ fn is_japanese_letter(c: char) -> bool { return true; } is_cjk(c) - && !matches!(c as u32, 0x3000..=0x303F | 0xAC00..=0xD7AF | 0xFF01..=0xFF0F | 0xFF1A..=0xFF20 | 0xFF3B..=0xFF40 | 0xFF5B..=0xFF65) + && !matches!( + c as u32, + 0x3000..=0x303F | 0x3130..=0x318F | 0xAC00..=0xD7AF | 0xFF01..=0xFF0F | 0xFF1A..=0xFF20 | 0xFF3B..=0xFF40 | 0xFF5B..=0xFF65 | 0xFFA0..=0xFFDC + ) && c != '・' && punct(c).is_none() } @@ -818,7 +821,8 @@ fn japanese_letters_for_the_latin_space_are_kana_kanji_and_marks_not_hangul_or_p for c in ['あ', 'カ', '漢', '々', '〆', '〇', 'A'] { assert!(is_japanese_letter(c), "{c}"); } - for c in ['한', '。', '「', '・', '、', 'a'] { + // Hangul in every form: syllables, compatibility jamo (ㄱ ㅏ), half-width jamo (ᄀ). + for c in ['한', 'ㄱ', 'ㅏ', '\u{FFA1}', '。', '「', '・', '、', 'a'] { assert!(!is_japanese_letter(c), "{c}"); } }