EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge remote-tracking branch 'origin/main' into jp/cjk-composition-rendering
midasdfbf069fe4f9d1
diff --cc crates/text/src/fonts.rsindex e41d28098,724fc4aaf..f98cce188--- a/crates/text/src/fonts.rs+++ b/crates/text/src/fonts.rs@@@ -995,15 -1033,77 +1053,86 @@@ fn system_fallback(c: char, style: &strmod tests {use super::*;+ /// Clears the requested CJK locale when a test that set it ends, panic or not.+ struct LocaleReset;++ impl Drop for LocaleReset {+ fn drop(&mut self) {+ set_cjk_locale("");+ }+ }++ /// Concurrent language requests must neither choose another context's font nor reuse its+ /// cached family order. Synthetic fonts in a child process keep this independent of the host+ /// font installation and of other tests that exercise the process-global database/locale.+ #[test]+ #[cfg(not(target_arch = "wasm32"))]+ fn cjk_requests_keep_their_language_and_cache_entries() {+ const CHILD: &str = "EFFECTCRAFT_TEST_ISOLATED_CJK";+ if std::env::var_os(CHILD).is_none() {+ let output = std::process::Command::new(std::env::current_exe().unwrap())+ .args(["--exact", "fonts::tests::cjk_requests_keep_their_language_and_cache_entries", "--nocapture"])+ .env(CHILD, "1")+ .output()+ .unwrap();+ assert!(output.status.success(), "{}\n{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));+ return;+ }+ let families = [("ja", "Yu Gothic"), ("zh-hans", "Microsoft YaHei"), ("zh-hant", "Microsoft JhengHei"), ("ko", "Malgun Gothic")];+ let mut expected = Vec::new();+ {+ let mut d = db().write().unwrap();+ d.scanned = true; // This test process uses only bundled and synthetic fonts.+ for (language, family) in families {+ let mut data = test_font(family);+ let table = data[12..12 + 8 * 16].as_chunks::<16>().0.iter().find(|t| &t[..4] == b"cmap").unwrap();+ let cmap = u32::from_be_bytes(table[8..12].try_into().unwrap()) as usize + 12;+ // Map 页 to the fixture's triangle glyph instead of its private-use range.+ // All four fonts cover the probe, so coverage cannot choose the right language.+ for (offset, value) in [(16, '页' as u16), (24, '页' as u16), (30, 2u16.wrapping_sub('页' as u16))] {+ data[cmap + offset..cmap + offset + 2].copy_from_slice(&value.to_be_bytes());+ }+ let data = Arc::new(data);+ let names = read_faces_bytes(&data).into_iter().next().unwrap();+ let id = push(&mut d, info_from(names, FaceData::Shared(data), "test"));+ expected.push((language, id));+ }+ }+ let base = resolve("Inter", "Regular").face;+ for &(_, id) in &expected {+ assert!(face(id).has_char('页'));+ }+ // Force the original interleaving: Chinese starts, then Japanese replaces the global+ // language before Chinese looks up its probe. The explicit request must still win.+ set_cjk_locale("zh-hans");+ set_cjk_locale("ja");+ assert_eq!(fallback_for('页', base), expected[0].1);+ assert_eq!(fallback_for_locale('页', base, "zh-hans"), expected[1].1);+ // Do not clear the cache here: different policies must coexist in the same cache.+ for _ in 0..3 {+ for &(language, id) in &expected {+ assert_eq!(fallback_for_locale('页', base, language), id, "{language}");+ }+ }+ let barrier = Arc::new(std::sync::Barrier::new(expected.len()));+ let threads: Vec<_> = expected+ .into_iter()+ .map(|(language, id)| {+ let barrier = barrier.clone();+ std::thread::spawn(move || {+ barrier.wait();+ for _ in 0..128 {+ set_cjk_locale(if language == "ja" { "zh-hans" } else { "ja" });+ assert_eq!(fallback_for_locale('页', base, language), id, "{language}");+ }+ })+ })+ .collect();+ for thread in threads {+ thread.join().unwrap();+ }+ }+#[test]fn extra_font_dirs_come_from_a_path_list() {assert!(extra_dirs(None).is_empty());@@@ -1343,71 -1454,30 +1490,95 @@@assert_eq!(han_order_for("ja_JP.UTF-8")[0], FallbackScript::Japanese);}+ /// macOS ships no Simplified Chinese PingFang on an English install (macOS 27 has the+ /// on-demand PingFang instead): Hiragino Sans GB, Heiti SC and Songti SC are the installed+ /// Chinese faces, so the Han list has to name them or Han text falls through to the Japanese+ /// face and draws Japanese glyph forms (#453). The system check is skipped where none of them+ /// is installed; the list itself is checked everywhere.+ #[test]+ fn macos_chinese_faces_are_tried_for_han_text() {+ for face in ["Hiragino Sans GB", "Heiti SC", "Songti SC"] {+ assert!(SIMPLIFIED_CHINESE_FAMILIES.iter().any(|l| l.eq_ignore_ascii_case(face)), "{face} missing from the Han list");+ }+ assert!(TRADITIONAL_CHINESE_FAMILIES.iter().any(|l| l.eq_ignore_ascii_case("Songti TC")), "Songti TC missing from the Traditional list");+ scan_system();+ let installed: Vec<&str> = ["Hiragino Sans GB", "Heiti SC", "Songti SC"].into_iter().filter(|f| resolve_in(f, "Regular").is_some()).collect();+ if installed.is_empty() {+ eprintln!("no macOS Simplified Chinese face installed; skipping the system check");+ return;+ }+ // Walking the Han branch's own list finds a Chinese face before the Japanese face the+ // exhaustive search would have found (Hiragino Sans), and it covers the shared ideographs.+ let (family, resolved) =+ SIMPLIFIED_CHINESE_FAMILIES.iter().find_map(|f| resolve_in(f, "Regular").map(|r| (*f, r))).expect("an installed Simplified Chinese family");+ // An earlier name can win the walk when this Mac has it as well (`PingFang SC` on an older+ // install, or Microsoft YaHei / Noto Sans CJK SC through Office or Homebrew). That is just+ // as valid a Chinese fallback as the macOS trio; only the Japanese face would be a+ // regression. Each installed macOS face is on the list (checked above) and covers the+ // shared ideographs.+ assert!(!JAPANESE_FAMILIES.iter().any(|j| j.eq_ignore_ascii_case(family)), "{family} is a Japanese family");+ for c in ['骨', '直', '日'] {+ assert!(face(resolved.face).has_char(c), "{family} cannot draw {c}");+ }+ for name in installed {+ let resolved = resolve_in(name, "Regular").expect("installed above");+ for c in ['骨', '直', '日'] {+ assert!(face(resolved.face).has_char(c), "{name} cannot draw {c}");+ }+ }+ }++ /// #453 under a Chinese interface: Han text in a Latin-only family falls back through the Han+ /// list, in the locale's order, to an installed Simplified Chinese family; it must not reach the+ /// Japanese face the exhaustive search would pick. The direct family lookup above would not+ /// catch a `fallback_for` that skipped `han_order`. Skipped where no Simplified family is+ /// installed.+ #[test]+ fn chinese_han_text_falls_back_to_a_simplified_chinese_family() {+ let _locale = TEST_CJK_LOCALE.lock().unwrap_or_else(|e| e.into_inner());+ scan_system();+ if !SIMPLIFIED_CHINESE_FAMILIES.iter().any(|f| resolve_in(f, "Regular").is_some()) {+ eprintln!("no Simplified Chinese family installed; skipping");+ return;+ }+ set_cjk_locale("zh-CN");+ let _reset = LocaleReset;+ let inter = resolve("Inter", "Regular").face;+ for c in ['骨', '直', '日', '真'] {+ let f = face(fallback_for(c, inter));+ assert!(f.has_char(c), "{c}: {} {} lacks it", f.info.family, f.info.style);+ assert!(+ SIMPLIFIED_CHINESE_FAMILIES.iter().any(|n| n.eq_ignore_ascii_case(&f.info.family)),+ "{c} → {} is not a Simplified Chinese family",+ f.info.family+ );+ }+ }++ #[test]+ fn the_rendered_order_keeps_the_print_face_first() {+ // A composed frame renders with these lists, so they keep the platform's print order: the+ // interface prefers the platform's UI faces on its own (see `install_script_fallbacks` in+ // the ui crate), and an existing project must not render differently because a window's+ // chrome changed.+ let pos = |list: &[&str], name: &str| list.iter().position(|f| *f == name).unwrap_or(usize::MAX);+ assert!(+ pos(JAPANESE_FAMILIES, "Yu Gothic") < pos(JAPANESE_FAMILIES, "Yu Gothic UI"),+ "the print face must come before its UI sibling: {JAPANESE_FAMILIES:?}"+ );+ for name in ["Meiryo UI", "MS UI Gothic"] {+ assert!(!JAPANESE_FAMILIES.contains(&name), "{name} belongs to the interface order, not this list");+ }+ assert_eq!(SIMPLIFIED_CHINESE_FAMILIES[0], "Microsoft YaHei");+ assert_eq!(TRADITIONAL_CHINESE_FAMILIES[0], "Microsoft JhengHei");+ for name in ["Microsoft YaHei UI", "Microsoft JhengHei UI", "PMingLiU"] {+ assert!(+ !SIMPLIFIED_CHINESE_FAMILIES.contains(&name) && !TRADITIONAL_CHINESE_FAMILIES.contains(&name),+ "{name} belongs to the interface order, not these lists"+ );+ }+ }+#[test]fn bundled_ui_fonts_cover_the_ukrainian_alphabet() {const ALPHABET: &str = "АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯабвгґдеєжзиіїйклмнопрстуфхцчшщьюя’«»";diff --cc docs/localization-parity.mdindex b99ad5884,d642af43c..651e311bb--- a/docs/localization-parity.md+++ b/docs/localization-parity.md@@@ -1,6 -1,6 +1,6 @@@# Localization parity- > **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-22 · **Change:** minor (the Chinese Han fallback reaches the installed Chinese faces, so Chinese text in compositions draws Chinese glyph forms, #453; previous: minor, catalogs recounted at `upstream/main` 470ea7a3: menus in 10 languages, panels in 6, Hangul probe (#599)) · **Target:** Adobe After Effects 2026-> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-23 · **Change:** minor (Georgian: menus, panels and effect names; missing strings show in English; `missing_translations_report` lists them) · **Target:** Adobe After Effects 2026++> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-23 · **Change:** minor (Georgian: menus, panels and effect names; missing strings show in English; `missing_translations_report` lists them; previous: minor, the Chinese Han fallback reaches the installed Chinese faces, so Chinese text in compositions draws Chinese glyph forms, #453; previous: minor, catalogs recounted at `upstream/main` 470ea7a3: menus in 10 languages, panels in 6, Hangul probe (#599)) · **Target:** Adobe After Effects 2026How much of EffectCraft's interface is translated, language by language, compared with AfterEffects. [gaps.md](gaps.md) gap 16 and workstream G9 hold the work;@@@ -103,8 -111,8 +111,9 @@@ can give; only Georgian, contributed b| Date | Change | Summary ||---|---|---|+| 2026-10-22 | minor | Chinese text in compositions follows the fixed Han fallback: installed Chinese faces are tried before the Japanese face (#453) || 2026-10-12 | minor | Recounted: Russian, French, German and Czech menus (#873, #987), Brazilian Portuguese and Czech panels (#830, #987), Hangul probe (#599); overall ≈ 12% to ≈ 18%; Korean and Italian still absent |+ | 2026-10-14 | minor | Georgian (`ka`): menus 628, panels 886 (191 Georgian-only, in `GEORGIAN_PANELS`), effect names and categories in `effects.rs` || 2026-10-10 | major | First localization parity document: catalog rows counted for all six languages, the twelve-language table, After Effects' 11 shipped languages from its bundle || 2026-10-11 | minor | Ukrainian panel catalog brought level with the Chinese ones (495 of 496 rows, counted at this commit); its share rises to ≈ 29%. The other languages' panel counts are the 10 October measurement || 2026-10-13 | minor | Effect names and the generated Effect menu leave English: `i18n/effects.rs` adds 306 rows keyed by effect id (Simplified Chinese, from After Effects 2026's interface and Adobe's Chinese documentation for the `CC` series) and the 21 category names. Parameter names are still English; no other language has rows |