From 35124cc9242afaa2311de43a71af8dd6a325edb1 Mon Sep 17 00:00:00 2001 From: FeiLiuEM Date: Mon, 12 Oct 2026 21:57:49 +0800 Subject: [PATCH] text: the Traditional list drops a Simplified face and adds the macOS Traditional ones WenQuanYi Micro Hei is a Simplified-oriented face, so keeping it in the Traditional list - even as a last resort - could still draw Simplified forms, which is the one thing the split is for. Heiti TC and Hiragino Sans CNS are the macOS Traditional faces the family's own lists use (photocraft's `CjkScript::TraditionalChinese`). Dropping the entry does not lose the face: the generic scan behind the script lists still finds it when nothing Traditional is installed. The test now walks the `FallbackScript::Han` arm as well, so a list wired to the wrong script fails it, and it refuses a WenQuanYi entry in the Traditional list. --- crates/text/src/fonts.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/text/src/fonts.rs b/crates/text/src/fonts.rs index 7ef9c1d82..401b107a2 100644 --- a/crates/text/src/fonts.rs +++ b/crates/text/src/fonts.rs @@ -597,7 +597,7 @@ const SIMPLIFIED_CHINESE_FAMILIES: &[&str] = /// Traditional interface with Simplified forms - the faces do not differ in *coverage*, which is /// what the fallback search checks, so the script has to pick the list. const TRADITIONAL_CHINESE_FAMILIES: &[&str] = - &["Microsoft JhengHei", "MingLiU", "PingFang TC", "Noto Sans CJK TC", "Noto Sans TC", "Source Han Sans TC", "WenQuanYi Micro Hei"]; + &["Microsoft JhengHei", "MingLiU", "PingFang TC", "Heiti TC", "Hiragino Sans CNS", "Noto Sans CJK TC", "Noto Sans TC", "Source Han Sans TC"]; const KOREAN_FAMILIES: &[&str] = &["Malgun Gothic", "Gulim", "Apple SD Gothic Neo", "Noto Sans CJK KR", "Noto Sans KR", "Source Han Sans KR", "NanumGothic"]; /// The platforms' plain text families for the other scripts the bundled fonts lack, in the same /// order (Windows, macOS, then the Linux/Noto names). @@ -1107,7 +1107,10 @@ mod tests { assert!(SIMPLIFIED_CHINESE_FAMILIES.iter().any(|f| f.contains("PingFang SC") && !f.contains("Source"))); assert!(!SIMPLIFIED_CHINESE_FAMILIES.iter().any(|f| f.contains("TC") || f.contains("JhengHei"))); assert!(TRADITIONAL_CHINESE_FAMILIES.iter().any(|f| f.contains("PingFang TC"))); - assert!(!TRADITIONAL_CHINESE_FAMILIES.iter().any(|f| f.contains(" SC") || f.contains("YaHei"))); + assert!(!TRADITIONAL_CHINESE_FAMILIES.iter().any(|f| f.contains(" SC") || f.contains("YaHei") || f.contains("WenQuanYi"))); + assert!(TRADITIONAL_CHINESE_FAMILIES.iter().any(|f| f.contains("Heiti TC") || f.contains("Hiragino Sans CNS"))); + // The arm the fallback itself walks: Han hands over the list the locale's script picked. + assert_eq!(families_for(FallbackScript::Han), chinese_families_for(&active_cjk_locale())); // Han text is the only thing these lists serve; the Japanese order does not change. assert_eq!(han_order_for("ja_JP.UTF-8")[0], FallbackScript::Japanese); }