From 131e4b325258021a6b7902641797c353497fdb94 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 14:43:58 -0800 Subject: [PATCH 1/2] Fonts: substitute test checks whether the original family is installed microsoft_families_resolve_to_metric_compatible_substitutes took resolve's own answer as the sign that Calibri or Cambria is installed, so it passed when an installed original lost to its substitute. It now looks for the family among the registered faces and, when it is there, requires resolve to pick it and report it as not missing. --- crates/text/src/fonts/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/text/src/fonts/tests.rs b/crates/text/src/fonts/tests.rs index 2e04e5f0e..d0cb53ea5 100644 --- a/crates/text/src/fonts/tests.rs +++ b/crates/text/src/fonts/tests.rs @@ -459,7 +459,9 @@ fn microsoft_families_resolve_to_metric_compatible_substitutes() { let resolved = resolve(requested, style); let family = &face(resolved.face).info.family; - if family.eq_ignore_ascii_case(requested) { + let installed = all_faces().iter().any(|f| f.info.family.eq_ignore_ascii_case(requested)); + if installed { + assert!(family.eq_ignore_ascii_case(requested), "an installed {requested} wins over {family}"); assert!(!resolved.missing, "an installed original family is available"); } else { assert_eq!(family, substitute); From c48abd7964982e916e3ae007f6a2dbc31ced9f9d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 15:07:52 -0800 Subject: [PATCH 2/2] Fonts: test that an installed Microsoft family wins over its substitute --- crates/text/src/fonts/tests.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/text/src/fonts/tests.rs b/crates/text/src/fonts/tests.rs index d0cb53ea5..ba1e33b25 100644 --- a/crates/text/src/fonts/tests.rs +++ b/crates/text/src/fonts/tests.rs @@ -473,6 +473,24 @@ fn microsoft_families_resolve_to_metric_compatible_substitutes() { assert!(unknown.missing); } +/// An installed Microsoft family is used as is and not reported missing, even when its +/// substitute is also available (#1677). It runs in a child process so the Calibri fixture does +/// not reach the substitute test above. +#[test] +#[cfg(not(target_arch = "wasm32"))] +fn an_installed_microsoft_family_wins_over_its_substitute() { + const CHILD: &str = "EFFECTCRAFT_TEST_ISOLATED_CALIBRI"; + if std::env::var_os(CHILD).is_none() { + run_in_child(CHILD, "fonts::tests::an_installed_microsoft_family_wins_over_its_substitute"); + return; + } + add_font_data(test_font("Carlito")); + add_font_data(test_font("Calibri")); + let resolved = resolve("Calibri", "Regular"); + assert_eq!(face(resolved.face).info.family, "Calibri"); + assert!(!resolved.missing, "the installed family is available"); +} + #[test] fn the_han_order_follows_the_cjk_locale() { // Chinese first for any Chinese tag, whether or not it names a script.